1
2
3
4
5
6
7
8
9
10 #define PORT_COMMAND 0x00
11 #define PORT_STATUS 0x02
12 #define PORT_AUXDMA 0x02
13 #define PORT_DATA 0x04
14 #define PORT_CONTROL 0x06
15
16
17
18
19 #define ATTN 0x80
20 #define FLSH 0x40
21 #define DMAE 0x20
22 #define DIR 0x10
23 #define TCEN 0x08
24 #define CMDE 0x04
25 #define HSF2 0x02
26 #define HSF1 0x01
27
28
29
30
31 #define HSF_PCB_ACK HSF1
32 #define HSF_PCB_NAK HSF2
33 #define HSF_PCB_END (HSF2|HSF1)
34 #define HSF_PCB_MASK (HSF2|HSF1)
35
36
37
38
39 #define HRDY 0x80
40 #define HCRE 0x40
41 #define ACRF 0x20
42
43 #define DONE 0x08
44 #define ASF3 0x04
45 #define ASF2 0x02
46 #define ASF1 0x01
47
48
49
50
51 #define ASF_PCB_ACK ASF1
52 #define ASF_PCB_NAK ASF2
53 #define ASF_PCB_END (ASF2|ASF1)
54 #define ASF_PCB_MASK (ASF2|ASF1)
55
56
57
58
59 #define DMA_BRST 0x01
60
61
62
63
64 #define MAX_PCB_DATA 62
65
66
67
68
69
70
71
72
73
74
75 #define TIMEOUT 300
76
77
78
79
80
81
82
83 enum {
84
85
86
87 CMD_CONFIGURE_ADAPTER_MEMORY = 0x01,
88 CMD_CONFIGURE_82586 = 0x02,
89 CMD_STATION_ADDRESS = 0x03,
90 CMD_DMA_DOWNLOAD = 0x04,
91 CMD_DMA_UPLOAD = 0x05,
92 CMD_PIO_DOWNLOAD = 0x06,
93 CMD_PIO_UPLOAD = 0x07,
94 CMD_RECEIVE_PACKET = 0x08,
95 CMD_TRANSMIT_PACKET = 0x09,
96 CMD_NETWORK_STATISTICS = 0x0a,
97 CMD_LOAD_MULTICAST_LIST = 0x0b,
98 CMD_CLEAR_PROGRAM = 0x0c,
99 CMD_DOWNLOAD_PROGRAM = 0x0d,
100 CMD_EXECUTE_PROGRAM = 0x0e,
101 CMD_SELF_TEST = 0x0f,
102 CMD_SET_STATION_ADDRESS = 0x10,
103 CMD_ADAPTER_INFO = 0x11,
104 NUM_TRANSMIT_CMDS,
105
106
107
108
109 CMD_CONFIGURE_ADAPTER_RESPONSE = 0x31,
110 CMD_CONFIGURE_82586_RESPONSE = 0x32,
111 CMD_ADDRESS_RESPONSE = 0x33,
112 CMD_DOWNLOAD_DATA_REQUEST = 0x34,
113 CMD_UPLOAD_DATA_REQUEST = 0x35,
114 CMD_RECEIVE_PACKET_COMPLETE = 0x38,
115 CMD_TRANSMIT_PACKET_COMPLETE = 0x39,
116 CMD_NETWORK_STATISTICS_RESPONSE = 0x3a,
117 CMD_LOAD_MULTICAST_RESPONSE = 0x3b,
118 CMD_CLEAR_PROGRAM_RESPONSE = 0x3c,
119 CMD_DOWNLOAD_PROGRAM_RESPONSE = 0x3d,
120 CMD_EXECUTE_RESPONSE = 0x3e,
121 CMD_SELF_TEST_RESPONSE = 0x3f,
122 CMD_SET_ADDRESS_RESPONSE = 0x40,
123 CMD_ADAPTER_INFO_RESPONSE = 0x41
124 };
125
126
127
128
129 typedef unsigned char byte;
130 typedef unsigned short int word;
131 typedef unsigned long int dword;
132
133
134 struct Memconf {
135 word cmd_q,
136 rcv_q,
137 mcast,
138 frame,
139 rcv_b,
140 progs;
141 };
142
143 struct Rcv_pkt {
144 word buf_ofs,
145 buf_seg,
146 buf_len,
147 timeout;
148 };
149
150 struct Xmit_pkt {
151 word buf_ofs,
152 buf_seg,
153 pkt_len;
154 };
155
156 struct Rcv_resp {
157 word buf_ofs,
158 buf_seg,
159 buf_len,
160 pkt_len,
161 timeout,
162 status;
163 dword timetag;
164 };
165
166 struct Xmit_resp {
167 word buf_ofs,
168 buf_seg,
169 c_stat,
170 status;
171 };
172
173
174 struct Netstat {
175 dword tot_recv,
176 tot_xmit;
177 word err_CRC,
178 err_align,
179 err_res,
180 err_ovrrun;
181 };
182
183
184 struct Selftest {
185 word error;
186 union {
187 word ROM_cksum;
188 struct {
189 word ofs, seg;
190 } RAM;
191 word i82586;
192 } failure;
193 };
194
195 struct Info {
196 byte minor_vers,
197 major_vers;
198 word ROM_cksum,
199 RAM_sz,
200 free_ofs,
201 free_seg;
202 };
203
204 struct Memdump {
205 word size,
206 off,
207 seg;
208 };
209
210
211
212
213
214
215 typedef struct {
216 byte command;
217 byte length;
218 union {
219 struct Memconf memconf;
220 word configure;
221 struct Rcv_pkt rcv_pkt;
222 struct Xmit_pkt xmit_pkt;
223 byte multicast[10][6];
224 byte eth_addr[6];
225 byte failed;
226 struct Rcv_resp rcv_resp;
227 struct Xmit_resp xmit_resp;
228 struct Netstat netstat;
229 struct Selftest selftest;
230 struct Info info;
231 struct Memdump memdump;
232 byte raw[62];
233 } data;
234 } pcb_struct;
235
236
237 #define RECV_STATION 0x00
238 #define RECV_BROAD 0x01
239 #define RECV_MULTI 0x02
240 #define RECV_PROMISC 0x04
241 #define NO_LOOPBACK 0x00
242 #define INT_LOOPBACK 0x08
243 #define EXT_LOOPBACK 0x10