summaryrefslogtreecommitdiff
path: root/linux/src/drivers/net/ni65.h
blob: 64380951e5aff70aad804dba47c0a139253df4ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/* am7990 (lance) definitions
 * 
 * This is an extension to the Linux operating system, and is covered by
 * same Gnu Public License that covers that work.
 * 
 * Michael Hipp
 * email: mhipp@student.uni-tuebingen.de
 *
 * sources: (mail me or ask archie if you need them) 
 *    crynwr-packet-driver
 */

/*
 * 	Control and Status Register 0 (CSR0) bit definitions
 * (R=Readable) (W=Writeable) (S=Set on write) (C-Clear on write)
 *
 */

#define CSR0_ERR	0x8000	/* Error summary (R) */
#define CSR0_BABL	0x4000	/* Babble transmitter timeout error (RC) */
#define CSR0_CERR	0x2000	/* Collision Error (RC) */
#define CSR0_MISS	0x1000	/* Missed packet (RC) */
#define CSR0_MERR	0x0800	/* Memory Error (RC) */ 
#define CSR0_RINT	0x0400	/* Receiver Interrupt (RC) */
#define CSR0_TINT       0x0200	/* Transmit Interrupt (RC) */ 
#define CSR0_IDON	0x0100	/* Initialization Done (RC) */
#define CSR0_INTR	0x0080	/* Interrupt Flag (R) */
#define CSR0_INEA	0x0040	/* Interrupt Enable (RW) */
#define CSR0_RXON	0x0020	/* Receiver on (R) */
#define CSR0_TXON	0x0010  /* Transmitter on (R) */
#define CSR0_TDMD	0x0008	/* Transmit Demand (RS) */
#define CSR0_STOP	0x0004 	/* Stop (RS) */
#define CSR0_STRT	0x0002	/* Start (RS) */
#define CSR0_INIT	0x0001	/* Initialize (RS) */

#define CSR0_CLRALL    0x7f00  /* mask for all clearable bits */
/*
 *	Initialization Block  Mode operation Bit Definitions.
 */

#define M_PROM		0x8000	/* Promiscuous Mode */
#define M_INTL		0x0040  /* Internal Loopback */
#define M_DRTY		0x0020  /* Disable Retry */ 
#define M_COLL		0x0010	/* Force Collision */
#define M_DTCR		0x0008	/* Disable Transmit CRC) */
#define M_LOOP		0x0004	/* Loopback */
#define M_DTX		0x0002	/* Disable the Transmitter */ 
#define M_DRX		0x0001  /* Disable the Receiver */


/*
 * 	Receive message descriptor bit definitions.
 */

#define RCV_OWN		0x80	/* owner bit 0 = host, 1 = lance */
#define RCV_ERR		0x40	/* Error Summary */
#define RCV_FRAM	0x20	/* Framing Error */
#define RCV_OFLO	0x10	/* Overflow Error */
#define RCV_CRC		0x08	/* CRC Error */ 
#define RCV_BUF_ERR	0x04	/* Buffer Error */
#define RCV_START	0x02	/* Start of Packet */
#define RCV_END		0x01	/* End of Packet */


/*
 *	Transmit  message descriptor bit definitions.
 */

#define XMIT_OWN	0x80	/* owner bit 0 = host, 1 = lance */
#define XMIT_ERR	0x40    /* Error Summary */
#define XMIT_RETRY	0x10	/* more the 1 retry needed to Xmit */
#define XMIT_1_RETRY	0x08	/* one retry needed to Xmit */
#define XMIT_DEF	0x04	/* Deferred */
#define XMIT_START	0x02	/* Start of Packet */
#define XMIT_END	0x01	/* End of Packet */

/*
 * transmit status (2) (valid if XMIT_ERR == 1)
 */

#define XMIT_TDRMASK    0x03ff  /* time-domain-reflectometer-value */
#define XMIT_RTRY 	0x0400  /* Failed after 16 retransmissions  */
#define XMIT_LCAR 	0x0800  /* Loss of Carrier */
#define XMIT_LCOL 	0x1000  /* Late collision */
#define XMIT_RESERV 	0x2000  /* Reserved */
#define XMIT_UFLO 	0x4000  /* Underflow (late memory) */
#define XMIT_BUFF 	0x8000  /* Buffering error (no ENP) */

struct init_block 
{
  unsigned short mode;
  unsigned char eaddr[6];
  unsigned char filter[8];
  /* bit 29-31: number of rmd's (power of 2) */
  u32 rrp;   /* receive ring pointer (align 8) */
  /* bit 29-31: number of tmd's (power of 2) */
  u32 trp;   /* transmit ring pointer (align 8) */
};

struct rmd /* Receive Message Descriptor */
{ 
  union
  {
    volatile u32 buffer;
    struct 
    {
      volatile unsigned char dummy[3];
      volatile unsigned char status; 
    } s;
  } u;
  volatile short blen;
  volatile unsigned short mlen;
};

struct tmd
{
  union 
  {
    volatile u32 buffer;
    struct 
    {
      volatile unsigned char dummy[3];
      volatile unsigned char status;
    } s;
  } u;
  volatile unsigned short blen;
  volatile unsigned short status2;
};