Modules/VIARhineII - Implementing, won't work yet
[tpg/acess2.git] / KernelLand / Modules / Network / VIARhineII / rhine2_hw.h
1 /*
2  * Acess2 VIA Rhine II Driver (VT6102)
3  * - By John Hodge (thePowersGang)
4  */
5 #ifndef _VIARHINEII__RHINE2_HW_H_
6 #define _VIARHINEII__RHINE2_HW_H_
7
8 enum eRegs
9 {
10         REG_PAR0, REG_PAR1,
11         REG_PAR2, REG_PAR3,
12         REG_PAR4, REG_PAR5,
13         REG_RCR,  REG_TCR,
14         REG_CR0,  REG_CR1,
15         REG_rsv0, REG_rsv1,
16         REG_ISR0, REG_ISR1,
17         REG_IMR0, REG_IMR1,
18         
19         REG_MAR0, REG_MAR1,
20         REG_MAR2, REG_MAR3,
21         REG_MAR4, REG_MAR5,
22         REG_MAR6, REG_MAR7,
23         
24         REG_CUR_RX_DESC,
25         REG_CUR_TX_DESC = 0x1C,
26
27         REG_GFTEST = 0x54, REG_RFTCMD,
28         REG_TFTCMD, REG_GFSTATUS,
29         REG_BNRY, _REG_BNRY_HI,
30         REG_CURR, _REG_CURR,
31         
32         //TODO: More?
33 };
34
35 #define RCR_SEP         (1 << 0)        // Accept error packets
36 #define RCR_AR          (1 << 1)        // Accept small packets (< 64 bytes)
37 #define RCR_AM          (1 << 2)        // Accept multicast packets
38 #define RCR_AB          (1 << 3)        // Accept broadcast packets
39 #define RCR_PROM        (1 << 4)        // Accept any addressed packet
40 #define RCR_RRFT(v)     (((v)&7)<<5)    // Recieve FIFO threshold (64,32,128,256,512,768,1024,s&f)
41
42 #define TCR_RSVD0       (1 << 0)        // reserved
43 #define TCR_LB(v)       (((v)&3)<<1)    // Loopback mode (normal, internal, MII, 223/other)
44 #define TCR_OFSET       (1 << 3)        // Backoff algo (VIA, Standard)
45 #define TCR_RSVD1       (1 << 4)        // reserved
46 #define TCR_TRSF(v)     (((v)&7)<<5)    // Transmit FIFO threshold
47
48 // TODO: Other Regs?
49
50 struct sRXDesc
51 {
52         Uint16  RSR;
53         Uint16  Length; // 11 bits, Bit 15 is owner bit
54         Uint16  BufferSize;     // 11 bits, Bit 15 is chain bit (means the packet continues in the next desc)
55         Uint16  _resvd;
56         Uint32  RXBufferStart;
57         Uint32  RDBranchAddress;        // ? - I'm guessing it's the next descriptor in the chain
58 };
59
60 #define RSR_RERR        (1 << 0)        // Receiver error
61 #define RSR_CRC         (1 << 1)        // CRC Error
62 #define RSR_FAE         (1 << 2)        // Frame Alignment error
63 #define RSR_FOV         (1 << 3)        // FIFO Overflow
64 #define RSR_LONG        (1 << 4)        // Long packet
65 #define RSR_RUNT        (1 << 5)        // Runt packet
66 #define RSR_SERR        (1 << 6)        // System Error
67 #define RSR_BUFF        (1 << 7)        // Buffer underflow
68 #define RSR_EDP         (1 << 8)        // End of Packet
69 #define RSR_STP         (1 << 9)        // Start of Packet
70 #define RSR_CHN         (1 << 10)       // Chain buffer
71 #define RSR_PHY         (1 << 11)       // Physical address match
72 #define RSR_BAR         (1 << 12)       // Broadcast packet
73 #define RSR_MAR         (1 << 13)       // Multicast packet
74 #define RSR_RESVD       (1 << 14)       // reserved
75 #define RSR_RXOK        (1 << 15)       // Recieved OK
76
77 struct sTXDesc
78 {
79         Uint32  TSR;
80         Uint16  BufferSize;     // 11 bits, bit 15 is chain
81         Uint8   TCR;
82         Uint8   _resvd;
83         Uint32  TXBufferStart;
84         Uint32  TDBranchAddress;        // Bit 0: Disable interrupt
85 };
86
87 #define TD_TCR_CRC      (1 << 0)        // Disable CRC generation
88 #define TD_TCR_STP      (1 << 5)        // First descriptor in packet
89 #define TD_TCR_EDP      (1 << 6)        // Last descriptor in packet
90 #define TD_TCR_IC       (1 << 7)        // Interrupt when transmitted
91
92 #endif
93

UCC git Repository :: git.ucc.asn.au