]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/lnc/if_lncreg.h
This commit was generated by cvs2svn to compensate for changes in r48905,
[FreeBSD/FreeBSD.git] / sys / dev / lnc / if_lncreg.h
1 /*
2  * Am7990, Local Area Network Controller for Ethernet (LANCE)
3  *
4  * Copyright (c) 1994, Paul Richards. This software may be used,
5  * modified, copied, distributed, and sold, in both source and binary
6  * form provided that the above copyright and these terms are retained.
7  * Under no circumstances is the author responsible for the proper
8  * functioning of this software, nor does the author assume any
9  * responsibility for damages incurred with its use.
10  *
11  */
12
13 /*
14  * The LANCE has four Control and Status Registers(CSRs) which are accessed
15  * through two bus addressable ports, the address port (RAP) and the data
16  * port (RDP).
17  *
18  */
19
20 #define CSR0    0
21 #define CSR1    1
22 #define CSR2    2
23 #define CSR3    3
24 #define CSR88   88
25 #define CSR89   89
26
27
28 /* Control and Status Register Masks */
29
30 /* CSR0 */
31
32 #define ERR     0x8000
33 #define BABL    0x4000
34 #define CERR    0x2000
35 #define MISS    0x1000
36 #define MERR    0x0800
37 #define RINT    0x0400
38 #define TINT    0x0200
39 #define IDON    0x0100
40 #define INTR    0x0080
41 #define INEA    0x0040
42 #define RXON    0x0020
43 #define TXON    0x0010
44 #define TDMD    0x0008
45 #define STOP    0x0004
46 #define STRT    0x0002
47 #define INIT    0x0001
48
49 /*
50  * CSR3
51  *
52  * Bits 3-15 are reserved.
53  *
54  */
55
56 #define BSWP    0x0004
57 #define ACON    0x0002
58 #define BCON    0x0001
59
60 /* Initialisation block */
61
62 struct init_block {
63         u_short mode;           /* Mode register                        */
64         u_char  padr[6];        /* Ethernet address                     */
65         u_char  ladrf[8];       /* Logical address filter (multicast)   */
66         u_short rdra;           /* Low order pointer to receive ring    */
67         u_short rlen;           /* High order pointer and no. rings     */
68         u_short tdra;           /* Low order pointer to transmit ring   */
69         u_short tlen;           /* High order pointer and no rings      */
70 };
71
72 /* Initialisation Block Mode Register Masks */
73
74 #define PROM      0x8000   /* Promiscuous Mode */
75 #define DRCVBC    0x4000   /* Disable Receive Broadcast */
76 #define DRCVPA    0x2000   /* Disable Receive Physical Address */
77 #define DLNKTST 0x1000   /* Disable Link Status */
78 #define DAPC      0x0800   /* Disable Automatic Polarity Correction */
79 #define MENDECL   0x0400   /* MENDEC Loopback Mode */
80 #define LRT       0x0200   /* Low Receive Threshold (T-MAU mode only) */
81 #define TSEL      0x0200   /* Transmit Mode Select  (AUI mode only) */
82 #define PORTSEL   0x0180   /* Port Select bits */
83 #define INTL      0x0040   /* Internal Loopback */
84 #define DRTY      0x0020   /* Disable Retry */
85 #define FCOLL     0x0010   /* Force Collision */
86 #define DXMTFCS   0x0008   /* Disable transmit CRC (FCS) */
87 #define LOOP      0x0004   /* Loopback Enabl */
88 #define DTX       0x0002   /* Disable the transmitter */
89 #define DRX       0x0001   /* Disable the receiver */
90
91 /*
92  * Message Descriptor Structure
93  *
94  * Each transmit or receive descriptor ring entry (RDRE's and TDRE's)
95  * is composed of 4, 16-bit, message descriptors. They contain the following
96  * information.
97  *
98  * 1. The address of the actual message data buffer in user (host) memory.
99  * 2. The length of that message buffer.
100  * 3. The status information for that particular buffer. The eight most
101  *    significant bits of md1 are collectively termed the STATUS of the
102  *    descriptor.
103  *
104  * Descriptor md0 contains LADR 0-15, the low order 16 bits of the 24-bit
105  * address of the actual data buffer.  Bits 0-7 of descriptor md1 contain
106  * HADR, the high order 8-bits of the 24-bit data buffer address. Bits 8-15
107  * of md1 contain the status flags of the buffer. Descriptor md2 contains the
108  * buffer byte count in bits 0-11 as a two's complement number and must have
109  * 1's written to bits 12-15. For the receive entry md3 has the Message Byte
110  * Count in bits 0-11, this is the length of the received message and is valid
111  * only when ERR is cleared and ENP is set. For the transmit entry it contains
112  * more status information.
113  *
114  */
115
116 struct mds {
117         u_short md0;
118         u_short md1;
119         short   md2;
120         u_short md3;
121 };
122
123 /* Receive STATUS flags for md1 */
124
125 #define OWN     0x8000          /* Owner bit, 0=host, 1=Lance   */
126 #define MDERR   0x4000          /* Error                        */
127 #define FRAM    0x2000          /* Framing error error          */
128 #define OFLO    0x1000          /* Silo overflow                */
129 #define CRC     0x0800          /* CRC error                    */
130 #define RBUFF   0x0400          /* Buffer error                 */
131 #define STP     0x0200          /* Start of packet              */
132 #define ENP     0x0100          /* End of packet                */
133 #define HADR    0x00FF          /* High order address bits      */
134
135 /* Receive STATUS flags for md2 */
136
137 #define BCNT    0x0FFF          /* Size of data buffer as 2's comp. no. */
138
139 /* Receive STATUS flags for md3 */
140
141 #define MCNT    0x0FFF          /* Total size of data for received packet */
142
143 /* Transmit STATUS flags for md1 */
144
145 #define ADD_FCS 0x2000          /* Controls generation of FCS   */
146 #define MORE    0x1000          /* Indicates more than one retry was needed */
147 #define ONE     0x0800          /* Exactly one retry was needed */
148 #define DEF     0x0400          /* Packet transmit deferred -- channel busy */
149
150 /*
151  * Transmit status flags for md2
152  *
153  * Same as for receive descriptor.
154  *
155  * BCNT   0x0FFF         Size of data buffer as 2's complement number.
156  *
157  */
158
159 /* Transmit status flags for md3 */
160
161 #define TBUFF   0x8000          /* Buffer error         */
162 #define UFLO    0x4000          /* Silo underflow       */
163 #define LCOL    0x1000          /* Late collision       */
164 #define LCAR    0x0800          /* Loss of carrier      */
165 #define RTRY    0x0400          /* Tried 16 times       */
166 #define TDR     0x03FF          /* Time domain reflectometry */
167