1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef DE600_IO
17#define DE600_IO 0x378
18#endif
19
20#define DATA_PORT (DE600_IO)
21#define STATUS_PORT (DE600_IO + 1)
22#define COMMAND_PORT (DE600_IO + 2)
23
24#ifndef DE600_IRQ
25#define DE600_IRQ 7
26#endif
27
28
29
30
31
32
33
34
35
36
37
38
39#define SELECT_NIC 0x04
40#define SELECT_PRN 0x1c
41#define NML_PRN 0xec
42#define IRQEN 0x10
43
44
45
46
47#define RX_BUSY 0x80
48#define RX_GOOD 0x40
49#define TX_FAILED16 0x10
50#define TX_BUSY 0x08
51
52
53
54
55
56
57
58#define WRITE_DATA 0x00
59#define READ_DATA 0x01
60#define STATUS 0x02
61#define COMMAND 0x03
62#define NULL_COMMAND 0x04
63#define RX_LEN 0x05
64#define TX_ADDR 0x06
65#define RW_ADDR 0x07
66#define HI_NIBBLE 0x08
67
68
69
70
71
72#define RX_ALL 0x01
73#define RX_BP 0x02
74#define RX_MBP 0x03
75
76#define TX_ENABLE 0x04
77#define RX_ENABLE 0x08
78
79#define RESET 0x80
80#define STOP_RESET 0x00
81
82
83
84
85
86#define RX_PAGE2_SELECT 0x10
87#define RX_BASE_PAGE 0x20
88#define FLIP_IRQ 0x40
89
90
91
92
93
94
95
96
97
98
99
100
101#define MEM_2K 0x0800
102#define MEM_4K 0x1000
103#define MEM_6K 0x1800
104#define NODE_ADDRESS 0x2000
105
106#define RUNT 60
107
108
109
110
111
112
113
114
115
116
117
118static u8 de600_read_status(struct net_device *dev);
119static u8 de600_read_byte(unsigned char type, struct net_device *dev);
120
121
122static int de600_open(struct net_device *dev);
123static int de600_close(struct net_device *dev);
124static struct net_device_stats *get_stats(struct net_device *dev);
125static int de600_start_xmit(struct sk_buff *skb, struct net_device *dev);
126
127
128static irqreturn_t de600_interrupt(int irq, void *dev_id, struct pt_regs *regs);
129static int de600_tx_intr(struct net_device *dev, int irq_status);
130static void de600_rx_intr(struct net_device *dev);
131
132
133static void trigger_interrupt(struct net_device *dev);
134int de600_probe(struct net_device *dev);
135static int adapter_init(struct net_device *dev);
136
137
138
139
140
141#define select_prn() outb_p(SELECT_PRN, COMMAND_PORT); DE600_SLOW_DOWN
142#define select_nic() outb_p(SELECT_NIC, COMMAND_PORT); DE600_SLOW_DOWN
143
144
145#define de600_put_byte(data) ( \
146 outb_p(((data) << 4) | WRITE_DATA , DATA_PORT), \
147 outb_p(((data) & 0xf0) | WRITE_DATA | HI_NIBBLE, DATA_PORT))
148
149
150
151
152
153#define de600_put_command(cmd) ( \
154 outb_p(( rx_page << 4) | COMMAND , DATA_PORT), \
155 outb_p(( rx_page & 0xf0) | COMMAND | HI_NIBBLE, DATA_PORT), \
156 outb_p(((rx_page | cmd) << 4) | COMMAND , DATA_PORT), \
157 outb_p(((rx_page | cmd) & 0xf0) | COMMAND | HI_NIBBLE, DATA_PORT))
158
159#define de600_setup_address(addr,type) ( \
160 outb_p((((addr) << 4) & 0xf0) | type , DATA_PORT), \
161 outb_p(( (addr) & 0xf0) | type | HI_NIBBLE, DATA_PORT), \
162 outb_p((((addr) >> 4) & 0xf0) | type , DATA_PORT), \
163 outb_p((((addr) >> 8) & 0xf0) | type | HI_NIBBLE, DATA_PORT))
164
165#define rx_page_adr() ((rx_page & RX_PAGE2_SELECT)?(MEM_6K):(MEM_4K))
166
167
168#define next_rx_page() (rx_page ^= RX_PAGE2_SELECT)
169
170#define tx_page_adr(a) (((a) + 1) * MEM_2K)
171