xref: /minix3/minix/drivers/net/lance/lance.h (revision f7df02e7476731c31f12548e38bcadbaf0233f6a)
1433d6423SLionel Sambuc 
2433d6423SLionel Sambuc /* ====== ethernet card info. ====== */
3433d6423SLionel Sambuc typedef struct ether_card
4433d6423SLionel Sambuc {
5*f7df02e7SDavid van Moolenbroek   unsigned int ec_mode;
6433d6423SLionel Sambuc   port_t ec_port;
7433d6423SLionel Sambuc   int ec_irq;
8433d6423SLionel Sambuc   int ec_hook;
9433d6423SLionel Sambuc } ether_card_t;
10433d6423SLionel Sambuc 
11433d6423SLionel Sambuc /*
12433d6423SLionel Sambuc  * NOTE: Not all the CSRs are defined. Just the ones that were deemed
13433d6423SLionel Sambuc  * necessary or potentially useful.
14433d6423SLionel Sambuc  */
15433d6423SLionel Sambuc 
16433d6423SLionel Sambuc /* Control and Status Register Addresses */
17433d6423SLionel Sambuc #define LANCE_CSR0   0   /* Controller Status Register */
18433d6423SLionel Sambuc #define LANCE_CSR1   1   /* Initialization Block Address (Lower) */
19433d6423SLionel Sambuc #define LANCE_CSR2   2   /* Initialization Block Address (Upper) */
20433d6423SLionel Sambuc #define LANCE_CSR3   3   /* Interrupt Masks and Deferral Control */
21433d6423SLionel Sambuc #define LANCE_CSR4   4   /* Test and Features Control */
22433d6423SLionel Sambuc #define LANCE_CSR5   5   /* Extended Control and Interrupt */
23433d6423SLionel Sambuc #define LANCE_CSR8   8   /* Logical Address Filter 0 */
24433d6423SLionel Sambuc #define LANCE_CSR9   9   /* Logical Address Filter 1 */
25433d6423SLionel Sambuc #define LANCE_CSR10 10   /* Logical Address Filter 2 */
26433d6423SLionel Sambuc #define LANCE_CSR11 11   /* Logical Address Filter 3 */
27433d6423SLionel Sambuc #define LANCE_CSR15 15   /* Mode */
28433d6423SLionel Sambuc #define LANCE_CSR88 88   /* Chip ID Register (Lower) */
29433d6423SLionel Sambuc #define LANCE_CSR89 89   /* Chip ID Register (Upper) */
30433d6423SLionel Sambuc 
31433d6423SLionel Sambuc /* Control and Status Register 0 (CSR0) */
32433d6423SLionel Sambuc #define LANCE_CSR0_ERR       0x8000 /* Error Occurred */
33433d6423SLionel Sambuc #define LANCE_CSR0_BABL      0x4000 /* Transmitter Timeout Error */
34433d6423SLionel Sambuc #define LANCE_CSR0_CERR      0x2000 /* Collision Error */
35433d6423SLionel Sambuc #define LANCE_CSR0_MISS      0x1000 /* Missed Frame */
36433d6423SLionel Sambuc #define LANCE_CSR0_MERR      0x0800 /* Memory Error */
37433d6423SLionel Sambuc #define LANCE_CSR0_RINT      0x0400 /* Receive Interrupt */
38433d6423SLionel Sambuc #define LANCE_CSR0_TINT      0x0200 /* Transmit Interrupt */
39433d6423SLionel Sambuc #define LANCE_CSR0_IDON      0x0100 /* Initialization Done */
40433d6423SLionel Sambuc #define LANCE_CSR0_INTR      0x0080 /* Interrupt Flag */
41433d6423SLionel Sambuc #define LANCE_CSR0_IENA      0x0040 /* Interrupt Enable */
42433d6423SLionel Sambuc #define LANCE_CSR0_RXON      0x0020 /* Receive On */
43433d6423SLionel Sambuc #define LANCE_CSR0_TXON      0x0010 /* Transmit On */
44433d6423SLionel Sambuc #define LANCE_CSR0_TDMD      0x0008 /* Transmit Demand */
45433d6423SLionel Sambuc #define LANCE_CSR0_STOP      0x0004 /* Stop */
46433d6423SLionel Sambuc #define LANCE_CSR0_STRT      0x0002 /* Start */
47433d6423SLionel Sambuc #define LANCE_CSR0_INIT      0x0001 /* Init */
48433d6423SLionel Sambuc 
49433d6423SLionel Sambuc /* Control and Status Register 3 (CSR3) */
50433d6423SLionel Sambuc /*                           0x8000    Reserved */
51433d6423SLionel Sambuc #define LANCE_CSR3_BABLM     0x4000 /* Babble Mask */
52433d6423SLionel Sambuc /*                           0x2000    Reserved */
53433d6423SLionel Sambuc #define LANCE_CSR3_MISSM     0x1000 /* Missed Frame Mask */
54433d6423SLionel Sambuc #define LANCE_CSR3_MERRM     0x0800 /* Memory Error Mask */
55433d6423SLionel Sambuc #define LANCE_CSR3_RINTM     0x0400 /* Receive Interrupt Mask */
56433d6423SLionel Sambuc #define LANCE_CSR3_TINTM     0x0200 /* Transmit Interrupt Mask */
57433d6423SLionel Sambuc #define LANCE_CSR3_IDONM     0x0100 /* Initialization Done Mask */
58433d6423SLionel Sambuc /*                           0x0080    Reserved */
59433d6423SLionel Sambuc #define LANCE_CSR3_DXSUFLO   0x0040 /* Disable Transmit Stop on Underflow */
60433d6423SLionel Sambuc #define LANCE_CSR3_LAPPEN    0x0020 /* Look Ahead Packet Processing Enable */
61433d6423SLionel Sambuc #define LANCE_CSR3_DXMT2PD   0x0010 /* Disable Transmit Two Part Deferral */
62433d6423SLionel Sambuc #define LANCE_CSR3_EMBA      0x0008 /* Enable Modified Back-off Algorithm */
63433d6423SLionel Sambuc #define LANCE_CSR3_BSWP      0x0004 /* Byte Swap */
64433d6423SLionel Sambuc /*                           0x0002    Reserved
65433d6423SLionel Sambuc  *                           0x0001    Reserved */
66433d6423SLionel Sambuc 
67433d6423SLionel Sambuc /* Control and Status Register 4 (CSR4) */
68433d6423SLionel Sambuc #define LANCE_CSR4_EN124     0x8000 /* Enable CSR124 Access */
69433d6423SLionel Sambuc #define LANCE_CSR4_DMAPLUS   0x4000 /* Disable DMA Burst Transfer Counter */
70433d6423SLionel Sambuc #define LANCE_CSR4_TIMER     0x2000 /* Enable Bus Activity Timer */
71433d6423SLionel Sambuc #define LANCE_CSR4_DPOLL     0x1000 /* Disable Transmit Polling */
72433d6423SLionel Sambuc #define LANCE_CSR4_APAD_XMT  0x0800 /* Auto Pad Transmit */
73433d6423SLionel Sambuc #define LANCE_CSR4_ASTRP_RCV 0x0400 /* Auto Strip Receive */
74433d6423SLionel Sambuc #define LANCE_CSR4_MFCO      0x0200 /* Missed Frame Counter Overflow */
75433d6423SLionel Sambuc #define LANCE_CSR4_MFCOM     0x0100 /* Missed Frame Counter Overflow Mask */
76433d6423SLionel Sambuc #define LANCE_CSR4_UINTCMD   0x0080 /* User Interrupt Command */
77433d6423SLionel Sambuc #define LANCE_CSR4_UINT      0x0040 /* User Interrupt */
78433d6423SLionel Sambuc #define LANCE_CSR4_RCVCCO    0x0020 /* Receive Collision Counter Overflow */
79433d6423SLionel Sambuc #define LANCE_CSR4_RCVCCOM   0x0010 /* Receive Collision Counter Overflow
80433d6423SLionel Sambuc                                      * Mask */
81433d6423SLionel Sambuc #define LANCE_CSR4_TXSTRT    0x0008 /* Transmit Start */
82433d6423SLionel Sambuc #define LANCE_CSR4_TXSTRTM   0x0004 /* Transmit Start Mask */
83433d6423SLionel Sambuc #define LANCE_CSR4_JAB       0x0002 /* Jabber Error */
84433d6423SLionel Sambuc #define LANCE_CSR4_JABM      0x0001 /* Jabber Error Mask */
85433d6423SLionel Sambuc 
86433d6423SLionel Sambuc /* Control and Status Register 5 (CSR5) */
87433d6423SLionel Sambuc #define LANCE_CSR5_TOKINTD   0x8000 /* Transmit OK Interrupt Disable */
88433d6423SLionel Sambuc #define LANCE_CSR5_LINTEN    0x4000 /* Last Transmit Interrupt Enable */
89433d6423SLionel Sambuc /*                           0x2000    Reserved
90433d6423SLionel Sambuc  *                           0x1000    Reserved */
91433d6423SLionel Sambuc #define LANCE_CSR5_SINT      0x0800 /* System Interrupt */
92433d6423SLionel Sambuc #define LANCE_CSR5_SINTE     0x0400 /* System Interrupt Enable */
93433d6423SLionel Sambuc #define LANCE_CSR5_SLPINT    0x0200 /* Sleep Interrupt */
94433d6423SLionel Sambuc #define LANCE_CSR5_SLPINTE   0x0100 /* Sleep Interrupt Enable */
95433d6423SLionel Sambuc #define LANCE_CSR5_EXDINT    0x0080 /* Excessive Deferral Interrupt */
96433d6423SLionel Sambuc #define LANCE_CSR5_EXDINTE   0x0040 /* Excessive Deferral Interrupt Enable */
97433d6423SLionel Sambuc #define LANCE_CSR5_MPPLBA    0x0020 /* Magic Packet Physical Logical Broadcast
98433d6423SLionel Sambuc                                      * Accept */
99433d6423SLionel Sambuc #define LANCE_CSR5_MPINT     0x0010 /* Magic Packet Interrupt */
100433d6423SLionel Sambuc #define LANCE_CSR5_MPINTE    0x0008 /* Magic Packet Interrupt Enable */
101433d6423SLionel Sambuc #define LANCE_CSR5_MPEN      0x0004 /* Magic Packet Enable */
102433d6423SLionel Sambuc #define LANCE_CSR5_MPMODE    0x0002 /* Magic Packet Mode */
103433d6423SLionel Sambuc #define LANCE_CSR5_SPND      0x0001 /* Suspend */
104433d6423SLionel Sambuc 
105433d6423SLionel Sambuc /* Control and Status Register 15 (CSR15) */
106433d6423SLionel Sambuc #define LANCE_CSR15_PROM     0x8000 /* Promiscuous Mode */
107433d6423SLionel Sambuc #define LANCE_CSR15_DRCVBC   0x4000 /* Disable Receive Broadcast */
108433d6423SLionel Sambuc #define LANCE_CSR15_DRCVPA   0x2000 /* Disable Receive Physical Address */
109433d6423SLionel Sambuc #define LANCE_CSR15_DLNKTST  0x1000 /* Disable Link Status */
110433d6423SLionel Sambuc #define LANCE_CSR15_DAPC     0x0800 /* Disable Automatic Polarity Correction */
111433d6423SLionel Sambuc #define LANCE_CSR15_MENDECL  0x0400 /* MENDEC Loopback Mode */
112433d6423SLionel Sambuc #define LANCE_CSR15_LRT      0x0200 /* Low Receive Threshold (T-MAU Mode) */
113433d6423SLionel Sambuc #define LANCE_CSR15_TSEL     0x0200 /* Transmit Mode Select  (AUI Mode) */
114433d6423SLionel Sambuc /*                           0x0100    Portsel[1]
115433d6423SLionel Sambuc  *                           0x0080    Portsel[0] */
116433d6423SLionel Sambuc #define LANCE_CSR15_INTL     0x0040 /* Internal Loopback */
117433d6423SLionel Sambuc #define LANCE_CSR15_DRTY     0x0020 /* Disable Retry */
118433d6423SLionel Sambuc #define LANCE_CSR15_FCOLL    0x0010 /* Force Collision */
119433d6423SLionel Sambuc #define LANCE_CSR15_DXMTFCS  0x0008 /* Disable Transmit CRC (FCS) */
120433d6423SLionel Sambuc #define LANCE_CSR15_LOOP     0x0004 /* Loopback Enable */
121433d6423SLionel Sambuc #define LANCE_CSR15_DTX      0x0002 /* Disable Transmit */
122433d6423SLionel Sambuc #define LANCE_CSR15_DRX      0x0001 /* Disable Receiver */
123