if_lereg.h revision 1.1
11.1Schuck/* $NetBSD: if_lereg.h,v 1.1 1995/07/25 23:12:31 chuck Exp $ */ 21.1Schuck 31.1Schuck/*- 41.1Schuck * Copyright (c) 1982, 1992, 1993 51.1Schuck * The Regents of the University of California. All rights reserved. 61.1Schuck * 71.1Schuck * Redistribution and use in source and binary forms, with or without 81.1Schuck * modification, are permitted provided that the following conditions 91.1Schuck * are met: 101.1Schuck * 1. Redistributions of source code must retain the above copyright 111.1Schuck * notice, this list of conditions and the following disclaimer. 121.1Schuck * 2. Redistributions in binary form must reproduce the above copyright 131.1Schuck * notice, this list of conditions and the following disclaimer in the 141.1Schuck * documentation and/or other materials provided with the distribution. 151.1Schuck * 3. All advertising materials mentioning features or use of this software 161.1Schuck * must display the following acknowledgement: 171.1Schuck * This product includes software developed by the University of 181.1Schuck * California, Berkeley and its contributors. 191.1Schuck * 4. Neither the name of the University nor the names of its contributors 201.1Schuck * may be used to endorse or promote products derived from this software 211.1Schuck * without specific prior written permission. 221.1Schuck * 231.1Schuck * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241.1Schuck * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251.1Schuck * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261.1Schuck * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 271.1Schuck * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281.1Schuck * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291.1Schuck * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301.1Schuck * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311.1Schuck * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321.1Schuck * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 331.1Schuck * SUCH DAMAGE. 341.1Schuck * 351.1Schuck * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93 361.1Schuck */ 371.1Schuck 381.1Schuck#define LEMTU 1518 391.1Schuck#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */ 401.1Schuck#define LERBUF 8 411.1Schuck#define LERBUFLOG2 3 421.1Schuck#define LE_RLEN (LERBUFLOG2 << 13) 431.1Schuck#define LETBUF 1 441.1Schuck#define LETBUFLOG2 0 451.1Schuck#define LE_TLEN (LETBUFLOG2 << 13) 461.1Schuck 471.1Schuck/* Local Area Network Controller for Ethernet (LANCE) registers */ 481.1Schuckstruct lereg1 { 491.1Schuck volatile u_short ler1_rdp; /* register data port */ 501.1Schuck volatile u_short ler1_rap; /* register address port */ 511.1Schuck}; 521.1Schuck 531.1Schuck/* register addresses */ 541.1Schuck#define LE_CSR0 0 /* Control and status register */ 551.1Schuck#define LE_CSR1 1 /* low address of init block */ 561.1Schuck#define LE_CSR2 2 /* high address of init block */ 571.1Schuck#define LE_CSR3 3 /* Bus master and control */ 581.1Schuck 591.1Schuck/* Control and status register 0 (csr0) */ 601.1Schuck#define LE_C0_ERR 0x8000 /* error summary */ 611.1Schuck#define LE_C0_BABL 0x4000 /* transmitter timeout error */ 621.1Schuck#define LE_C0_CERR 0x2000 /* collision */ 631.1Schuck#define LE_C0_MISS 0x1000 /* missed a packet */ 641.1Schuck#define LE_C0_MERR 0x0800 /* memory error */ 651.1Schuck#define LE_C0_RINT 0x0400 /* receiver interrupt */ 661.1Schuck#define LE_C0_TINT 0x0200 /* transmitter interrupt */ 671.1Schuck#define LE_C0_IDON 0x0100 /* initalization done */ 681.1Schuck#define LE_C0_INTR 0x0080 /* interrupt condition */ 691.1Schuck#define LE_C0_INEA 0x0040 /* interrupt enable */ 701.1Schuck#define LE_C0_RXON 0x0020 /* receiver on */ 711.1Schuck#define LE_C0_TXON 0x0010 /* transmitter on */ 721.1Schuck#define LE_C0_TDMD 0x0008 /* transmit demand */ 731.1Schuck#define LE_C0_STOP 0x0004 /* disable all external activity */ 741.1Schuck#define LE_C0_STRT 0x0002 /* enable external activity */ 751.1Schuck#define LE_C0_INIT 0x0001 /* begin initalization */ 761.1Schuck 771.1Schuck#define LE_C0_BITS \ 781.1Schuck "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\ 791.1Schuck\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT" 801.1Schuck 811.1Schuck/* Control and status register 3 (csr3) */ 821.1Schuck#define LE_C3_BSWP 0x4 /* byte swap */ 831.1Schuck#define LE_C3_ACON 0x2 /* ALE control, eh? */ 841.1Schuck#define LE_C3_BCON 0x1 /* byte control */ 851.1Schuck/* 861.1Schuck * Current size is 13,758 bytes with 8 x 1518 receive buffers and 871.1Schuck * 1 x 1518 transmit buffer. 881.1Schuck */ 891.1Schuckstruct lereg2 { 901.1Schuck /* initialization block */ 911.1Schuck volatile u_short ler2_mode; /* mode */ 921.1Schuck volatile u_char ler2_padr[6]; /* physical address */ 931.1Schuck#ifdef new_code 941.1Schuck volatile u_short ler2_ladrf[4]; /* logical address filter */ 951.1Schuck#else 961.1Schuck volatile u_long ler2_ladrf0; /* logical address filter */ 971.1Schuck volatile u_long ler2_ladrf1; /* logical address filter */ 981.1Schuck#endif 991.1Schuck volatile u_short ler2_rdra; /* receive descriptor addr */ 1001.1Schuck volatile u_short ler2_rlen; /* rda high and ring size */ 1011.1Schuck volatile u_short ler2_tdra; /* transmit descriptor addr */ 1021.1Schuck volatile u_short ler2_tlen; /* tda high and ring size */ 1031.1Schuck /* receive message descriptors. bits/hadr are byte order dependent. */ 1041.1Schuck struct lermd { 1051.1Schuck volatile u_short rmd0; /* low address of packet */ 1061.1Schuck volatile u_char rmd1_bits; /* descriptor bits */ 1071.1Schuck volatile u_char rmd1_hadr; /* high address of packet */ 1081.1Schuck volatile short rmd2; /* buffer byte count */ 1091.1Schuck volatile u_short rmd3; /* message byte count */ 1101.1Schuck } ler2_rmd[LERBUF]; 1111.1Schuck /* transmit message descriptors */ 1121.1Schuck struct letmd { 1131.1Schuck volatile u_short tmd0; /* low address of packet */ 1141.1Schuck volatile u_char tmd1_bits; /* descriptor bits */ 1151.1Schuck volatile u_char tmd1_hadr; /* high address of packet */ 1161.1Schuck volatile short tmd2; /* buffer byte count */ 1171.1Schuck volatile u_short tmd3; /* transmit error bits */ 1181.1Schuck } ler2_tmd[LETBUF]; 1191.1Schuck volatile char ler2_rbuf[LERBUF][LEMTU]; 1201.1Schuck volatile char ler2_tbuf[LETBUF][LEMTU]; 1211.1Schuck}; 1221.1Schuck 1231.1Schuck/* Initialzation block (mode) */ 1241.1Schuck#define LE_MODE_PROM 0x8000 /* promiscuous mode */ 1251.1Schuck/* 0x7f80 reserved, must be zero */ 1261.1Schuck#define LE_MODE_INTL 0x0040 /* internal loopback */ 1271.1Schuck#define LE_MODE_DRTY 0x0020 /* disable retry */ 1281.1Schuck#define LE_MODE_COLL 0x0010 /* force a collision */ 1291.1Schuck#define LE_MODE_DTCR 0x0008 /* disable transmit CRC */ 1301.1Schuck#define LE_MODE_LOOP 0x0004 /* loopback mode */ 1311.1Schuck#define LE_MODE_DTX 0x0002 /* disable transmitter */ 1321.1Schuck#define LE_MODE_DRX 0x0001 /* disable receiver */ 1331.1Schuck#define LE_MODE_NORMAL 0 /* none of the above */ 1341.1Schuck 1351.1Schuck 1361.1Schuck/* Receive message descriptor 1 (rmd1_bits) */ 1371.1Schuck#define LE_R1_OWN 0x80 /* LANCE owns the packet */ 1381.1Schuck#define LE_R1_ERR 0x40 /* error summary */ 1391.1Schuck#define LE_R1_FRAM 0x20 /* framing error */ 1401.1Schuck#define LE_R1_OFLO 0x10 /* overflow error */ 1411.1Schuck#define LE_R1_CRC 0x08 /* CRC error */ 1421.1Schuck#define LE_R1_BUFF 0x04 /* buffer error */ 1431.1Schuck#define LE_R1_STP 0x02 /* start of packet */ 1441.1Schuck#define LE_R1_ENP 0x01 /* end of packet */ 1451.1Schuck 1461.1Schuck#define LE_R1_BITS \ 1471.1Schuck "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP" 1481.1Schuck 1491.1Schuck/* Transmit message descriptor 1 (tmd1_bits) */ 1501.1Schuck#define LE_T1_OWN 0x80 /* LANCE owns the packet */ 1511.1Schuck#define LE_T1_ERR 0x40 /* error summary */ 1521.1Schuck#define LE_T1_MORE 0x10 /* multiple collisions */ 1531.1Schuck#define LE_T1_ONE 0x08 /* single collision */ 1541.1Schuck#define LE_T1_DEF 0x04 /* defferred transmit */ 1551.1Schuck#define LE_T1_STP 0x02 /* start of packet */ 1561.1Schuck#define LE_T1_ENP 0x01 /* end of packet */ 1571.1Schuck 1581.1Schuck#define LE_T1_BITS \ 1591.1Schuck "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP" 1601.1Schuck 1611.1Schuck/* Transmit message descriptor 3 (tmd3) */ 1621.1Schuck#define LE_T3_BUFF 0x8000 /* buffer error */ 1631.1Schuck#define LE_T3_UFLO 0x4000 /* underflow error */ 1641.1Schuck#define LE_T3_LCOL 0x1000 /* late collision */ 1651.1Schuck#define LE_T3_LCAR 0x0800 /* loss of carrier */ 1661.1Schuck#define LE_T3_RTRY 0x0400 /* retry error */ 1671.1Schuck#define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */ 1681.1Schuck 1691.1Schuck#define LE_XMD2_ONES 0xf000 1701.1Schuck 1711.1Schuck#define LE_T3_BITS \ 1721.1Schuck "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY" 1731.1Schuck 1741.1Schuck 1751.1Schuck#define LE_ADDR_LOW_MASK (0xffff) 1761.1Schuck 177