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