Initial import from FreeBSD RELENG_4:
[games.git] / sys / i386 / isa / ic / am7990.h
1 /*
2  *      AMD 7990 (LANCE) definitions
3  *
4  * $FreeBSD: src/sys/i386/isa/ic/am7990.h,v 1.3.6.1 2000/08/03 01:01:25 peter Exp $
5  */
6
7 #if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
8 #define LN_BITFIELD2(a, b)                    b, a
9 #define LN_BITFIELD3(a, b, c)              c, b, a
10 #define LN_BITFIELD4(a, b, c, d)        d, c, b, a
11 #else
12 #define LN_BITFIELD2(a, b)              a, b
13 #define LN_BITFIELD3(a, b, c)           a, b, c
14 #define LN_BITFIELD4(a, b, c, d)        a, b, c, d
15 #endif
16
17 #define LN_ADDR_LO(addr)                ((addr) & 0xFFFF)
18 #define LN_ADDR_HI(addr)                (((addr) >> 16) & 0xFF)
19
20 typedef struct {
21     unsigned short r_addr_lo;
22     unsigned int   LN_BITFIELD3(r_addr_hi   : 8,
23                                             : 5,
24                                 r_log2_size : 3);
25 } ln_ring_t;
26
27 #define LN_MC_MASK              0x3F    /* Only 6 bits of the CRC */
28
29 typedef struct {
30     unsigned short ln_mode;
31 #define LN_MODE_RXD             0x0001  /* ( W)  Receiver Disabled */
32 #define LN_MODE_TXD             0x0002  /* ( W)  Transmitter Disabled */
33 #define LN_MODE_LOOP            0x0004  /* ( W)  Enable Loopback */
34 #define LN_MODE_NOTXCRC         0x0008  /* ( W)  Don't Calculate TX CRCs */
35 #define LN_MODE_FRCCOLL         0x0010  /* ( W)  Force Collision */
36 #define LN_MODE_NORETRY         0x0020  /* ( W)  No Transmit Retries */
37 #define LN_MODE_INTLOOP         0x0040  /* ( W)  Internal Loopback */
38 #define LN_MODE_PROMISC         0x8000  /* ( W)  Promiscious Mode */
39     unsigned short ln_physaddr[3];
40     unsigned short ln_multi_mask[4];
41     ln_ring_t ln_rxring;
42     ln_ring_t ln_txring;
43 } ln_initb_t;
44
45 typedef struct {
46     unsigned short d_addr_lo;
47     unsigned char d_addr_hi;
48     unsigned char d_flag;
49 #define LN_DFLAG_EOP            0x0001  /* (RW)  End Of Packet */
50 #define LN_DFLAG_SOP            0x0002  /* (RW)  Start Of Packet */
51 #define LN_DFLAG_RxBUFERROR     0x0004  /* (R )  Receive  - Buffer Error */
52 #define LN_DFLAG_TxDEFERRED     0x0004  /* (R )  Transmit - Initially Deferred */
53 #define LN_DFLAG_RxBADCRC       0x0008  /* (R )  Receive  - Bad Checksum */
54 #define LN_DFLAG_TxONECOLL      0x0008  /* (R )  Transmit - Single Collision */
55 #define LN_DFLAG_RxOVERFLOW     0x0010  /* (R )  Receive  - Overflow Error */
56 #define LN_DFLAG_TxMULTCOLL     0x0010  /* (R )  Transmit - Multiple Collisions */
57 #define LN_DFLAG_RxFRAMING      0x0020  /* (R )  Receive  - Framing Error */
58 #define LN_DFLAG_RxERRSUM       0x0040  /* (R )  Receive  - Error Summary */
59 #define LN_DFLAG_TxERRSUM       0x0040  /* (R )  Transmit - Error Summary */
60 #define LN_DFLAG_OWNER          0x0080  /* (RW)  Owner (1=Am7990, 0=host) */
61     signed short d_buflen;              /* ( W)  Two's complement */
62     unsigned short d_status;
63 #define LN_DSTS_RxLENMASK       0x0FFF  /* (R )  Recieve Length */
64 #define LN_DSTS_TxTDRMASK       0x03FF  /* (R )  Transmit - Time Domain Reflectometer */
65 #define LN_DSTS_TxEXCCOLL       0x0400  /* (R )  Transmit - Excessive Collisions */
66 #define LN_DSTS_TxCARRLOSS      0x0800  /* (R )  Transmit - Carrier Loss */
67 #define LN_DSTS_TxLATECOLL      0x1000  /* (R )  Transmit - Late Collision */
68 #define LN_DSTS_TxUNDERFLOW     0x4000  /* (R )  Transmit - Underflow */
69 #define LN_DSTS_TxBUFERROR      0x8000  /* (R )  Transmit - Buffer Error */
70 } ln_desc_t;
71
72
73
74
75 #define LN_CSR0                 0x0000
76
77 #define LN_CSR0_INIT            0x0001  /* (RS)  Initialize Am 7990 */
78 #define LN_CSR0_START           0x0002  /* (RS)  Start Am7990 */
79 #define LN_CSR0_STOP            0x0004  /* (RS)  Reset Am7990 */
80 #define LN_CSR0_TXDEMAND        0x0008  /* (RS)  Transmit On Demand */
81 #define LN_CSR0_TXON            0x0010  /* (R )  Transmitter Enabled */
82 #define LN_CSR0_RXON            0x0020  /* (R )  Receiver Enabled */
83 #define LN_CSR0_ENABINTR        0x0040  /* (RW)  Interrupt Enabled */
84 #define LN_CSR0_PENDINTR        0x0080  /* (R )  Interrupt Pending */
85 #define LN_CSR0_INITDONE        0x0100  /* (RC)  Initialization Done */
86 #define LN_CSR0_TXINT           0x0200  /* (RC)  Transmit Interrupt */
87 #define LN_CSR0_RXINT           0x0400  /* (RC)  Receive Interrupt */
88 #define LN_CSR0_MEMERROR        0x0800  /* (RC)  Memory Error */
89 #define LN_CSR0_MISS            0x1000  /* (RC)  No Available Receive Buffers */
90 #define LN_CSR0_CERR            0x2000  /* (RC)  SQE failed */
91 #define LN_CSR0_BABL            0x4000  /* (RC)  Transmit Babble */
92 #define LN_CSR0_ERRSUM          0x8000  /* (R )  Error Summary (last 4) */
93 #define LN_CSR0_CLEAR           0x7F00  /*       Clear Status Bit */
94
95 /*
96  * CSR1 -- Init Block Address (Low 16 Bits -- Must be Word Aligned)
97  * CSR2 -- Init Block Address (High 8 Bits)
98  */
99 #define LN_CSR1                 0x0001
100 #define LN_CSR2                 0x0002
101
102 /*
103  * CSR3 -- Hardware Control
104  */
105
106 #define LN_CSR3                 0x0003
107 #define LN_CSR3_BCON            0x0001  /* (RW)  BM/HOLD Control */
108 #define LN_CSR3_ALE             0x0002  /* (RW)  ALE Control */
109 #define LN_CSR3_BSWP            0x0004  /* (RW)  Byte Swap */