MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / drivers / net / ni52.h
blob68f19175afba51a65775f67690ae408e42e69557
1 /*
2 * Intel i82586 Ethernet definitions
4 * This is an extension to the Linux operating system, and is covered by the
5 * same GNU General Public License that covers that work.
7 * copyrights (c) 1994 by Michael Hipp (hippm@informatik.uni-tuebingen.de)
9 * I have done a look in the following sources:
10 * crynwr-packet-driver by Russ Nelson
11 * Garret A. Wollman's i82586-driver for BSD
15 #define NI52_RESET 0 /* writing to this address, resets the i82586 */
16 #define NI52_ATTENTION 1 /* channel attention, kick the 586 */
17 #define NI52_TENA 3 /* 2-5 possibly wrong, Xmit enable */
18 #define NI52_TDIS 2 /* Xmit disable */
19 #define NI52_INTENA 5 /* Interrupt enable */
20 #define NI52_INTDIS 4 /* Interrupt disable */
21 #define NI52_MAGIC1 6 /* dunno exact function */
22 #define NI52_MAGIC2 7 /* dunno exact function */
24 #define NI52_MAGICVAL1 0x00 /* magic-values for ni5210 card */
25 #define NI52_MAGICVAL2 0x55
28 * where to find the System Configuration Pointer (SCP)
30 #define SCP_DEFAULT_ADDRESS 0xfffff4
34 * System Configuration Pointer Struct
37 struct scp_struct
39 unsigned short zero_dum0; /* has to be zero */
40 unsigned char sysbus; /* 0=16Bit,1=8Bit */
41 unsigned char zero_dum1; /* has to be zero for 586 */
42 unsigned short zero_dum2;
43 unsigned short zero_dum3;
44 char *iscp; /* pointer to the iscp-block */
49 * Intermediate System Configuration Pointer (ISCP)
51 struct iscp_struct
53 unsigned char busy; /* 586 clears after successful init */
54 unsigned char zero_dummy; /* has to be zero */
55 unsigned short scb_offset; /* pointeroffset to the scb_base */
56 char *scb_base; /* base-address of all 16-bit offsets */
60 * System Control Block (SCB)
62 struct scb_struct
64 unsigned char rus;
65 unsigned char cus;
66 unsigned char cmd_ruc; /* command word: RU part */
67 unsigned char cmd_cuc; /* command word: CU part & ACK */
68 unsigned short cbl_offset; /* pointeroffset, command block list */
69 unsigned short rfa_offset; /* pointeroffset, receive frame area */
70 unsigned short crc_errs; /* CRC-Error counter */
71 unsigned short aln_errs; /* alignmenterror counter */
72 unsigned short rsc_errs; /* Resourceerror counter */
73 unsigned short ovrn_errs; /* OVerrunerror counter */
77 * possible command values for the command word
79 #define RUC_MASK 0x0070 /* mask for RU commands */
80 #define RUC_NOP 0x0000 /* NOP-command */
81 #define RUC_START 0x0010 /* start RU */
82 #define RUC_RESUME 0x0020 /* resume RU after suspend */
83 #define RUC_SUSPEND 0x0030 /* suspend RU */
84 #define RUC_ABORT 0x0040 /* abort receiver operation immediately */
86 #define CUC_MASK 0x07 /* mask for CU command */
87 #define CUC_NOP 0x00 /* NOP-command */
88 #define CUC_START 0x01 /* start execution of 1. cmd on the CBL */
89 #define CUC_RESUME 0x02 /* resume after suspend */
90 #define CUC_SUSPEND 0x03 /* Suspend CU */
91 #define CUC_ABORT 0x04 /* abort command operation immediately */
93 #define ACK_MASK 0xf0 /* mask for ACK command */
94 #define ACK_CX 0x80 /* acknowledges STAT_CX */
95 #define ACK_FR 0x40 /* ack. STAT_FR */
96 #define ACK_CNA 0x20 /* ack. STAT_CNA */
97 #define ACK_RNR 0x10 /* ack. STAT_RNR */
100 * possible status values for the status word
102 #define STAT_MASK 0xf0 /* mask for cause of interrupt */
103 #define STAT_CX 0x80 /* CU finished cmd with its I bit set */
104 #define STAT_FR 0x40 /* RU finished receiving a frame */
105 #define STAT_CNA 0x20 /* CU left active state */
106 #define STAT_RNR 0x10 /* RU left ready state */
108 #define CU_STATUS 0x7 /* CU status, 0=idle */
109 #define CU_SUSPEND 0x1 /* CU is suspended */
110 #define CU_ACTIVE 0x2 /* CU is active */
112 #define RU_STATUS 0x70 /* RU status, 0=idle */
113 #define RU_SUSPEND 0x10 /* RU suspended */
114 #define RU_NOSPACE 0x20 /* RU no resources */
115 #define RU_READY 0x40 /* RU is ready */
118 * Receive Frame Descriptor (RFD)
120 struct rfd_struct
122 unsigned char stat_low; /* status word */
123 unsigned char stat_high; /* status word */
124 unsigned char rfd_sf; /* 82596 mode only */
125 unsigned char last; /* Bit15,Last Frame on List / Bit14,suspend */
126 unsigned short next; /* linkoffset to next RFD */
127 unsigned short rbd_offset; /* pointeroffset to RBD-buffer */
128 unsigned char dest[6]; /* ethernet-address, destination */
129 unsigned char source[6]; /* ethernet-address, source */
130 unsigned short length; /* 802.3 frame-length */
131 unsigned short zero_dummy; /* dummy */
134 #define RFD_LAST 0x80 /* last: last rfd in the list */
135 #define RFD_SUSP 0x40 /* last: suspend RU after */
136 #define RFD_COMPL 0x80
137 #define RFD_OK 0x20
138 #define RFD_BUSY 0x40
139 #define RFD_ERR_LEN 0x10 /* Length error (if enabled length-checking */
140 #define RFD_ERR_CRC 0x08 /* CRC error */
141 #define RFD_ERR_ALGN 0x04 /* Alignment error */
142 #define RFD_ERR_RNR 0x02 /* status: receiver out of resources */
143 #define RFD_ERR_OVR 0x01 /* DMA Overrun! */
145 #define RFD_ERR_FTS 0x0080 /* Frame to short */
146 #define RFD_ERR_NEOP 0x0040 /* No EOP flag (for bitstuffing only) */
147 #define RFD_ERR_TRUN 0x0020 /* (82596 only/SF mode) indicates truncated frame */
148 #define RFD_MATCHADD 0x0002 /* status: Destinationaddress !matches IA (only 82596) */
149 #define RFD_COLLDET 0x0001 /* Detected collision during reception */
152 * Receive Buffer Descriptor (RBD)
154 struct rbd_struct
156 unsigned short status; /* status word,number of used bytes in buff */
157 unsigned short next; /* pointeroffset to next RBD */
158 char *buffer; /* receive buffer address pointer */
159 unsigned short size; /* size of this buffer */
160 unsigned short zero_dummy; /* dummy */
163 #define RBD_LAST 0x8000 /* last buffer */
164 #define RBD_USED 0x4000 /* this buffer has data */
165 #define RBD_MASK 0x3fff /* size-mask for length */
168 * Statusvalues for Commands/RFD
170 #define STAT_COMPL 0x8000 /* status: frame/command is complete */
171 #define STAT_BUSY 0x4000 /* status: frame/command is busy */
172 #define STAT_OK 0x2000 /* status: frame/command is ok */
175 * Action-Commands
177 #define CMD_NOP 0x0000 /* NOP */
178 #define CMD_IASETUP 0x0001 /* initial address setup command */
179 #define CMD_CONFIGURE 0x0002 /* configure command */
180 #define CMD_MCSETUP 0x0003 /* MC setup command */
181 #define CMD_XMIT 0x0004 /* transmit command */
182 #define CMD_TDR 0x0005 /* time domain reflectometer (TDR) command */
183 #define CMD_DUMP 0x0006 /* dump command */
184 #define CMD_DIAGNOSE 0x0007 /* diagnose command */
187 * Action command bits
189 #define CMD_LAST 0x8000 /* indicates last command in the CBL */
190 #define CMD_SUSPEND 0x4000 /* suspend CU after this CB */
191 #define CMD_INT 0x2000 /* generate interrupt after execution */
194 * NOP - command
196 struct nop_cmd_struct
198 unsigned short cmd_status; /* status of this command */
199 unsigned short cmd_cmd; /* the command itself (+bits) */
200 unsigned short cmd_link; /* offsetpointer to next command */
204 * IA Setup command
206 struct iasetup_cmd_struct
208 unsigned short cmd_status;
209 unsigned short cmd_cmd;
210 unsigned short cmd_link;
211 unsigned char iaddr[6];
215 * Configure command
217 struct configure_cmd_struct
219 unsigned short cmd_status;
220 unsigned short cmd_cmd;
221 unsigned short cmd_link;
222 unsigned char byte_cnt; /* size of the config-cmd */
223 unsigned char fifo; /* fifo/recv monitor */
224 unsigned char sav_bf; /* save bad frames (bit7=1)*/
225 unsigned char adr_len; /* adr_len(0-2),al_loc(3),pream(4-5),loopbak(6-7)*/
226 unsigned char priority; /* lin_prio(0-2),exp_prio(4-6),bof_metd(7) */
227 unsigned char ifs; /* inter frame spacing */
228 unsigned char time_low; /* slot time low */
229 unsigned char time_high; /* slot time high(0-2) and max. retries(4-7) */
230 unsigned char promisc; /* promisc-mode(0) , et al (1-7) */
231 unsigned char carr_coll; /* carrier(0-3)/collision(4-7) stuff */
232 unsigned char fram_len; /* minimal frame len */
233 unsigned char dummy; /* dummy */
237 * Multicast Setup command
239 struct mcsetup_cmd_struct
241 unsigned short cmd_status;
242 unsigned short cmd_cmd;
243 unsigned short cmd_link;
244 unsigned short mc_cnt; /* number of bytes in the MC-List */
245 unsigned char mc_list[0][6]; /* pointer to 6 bytes entries */
249 * DUMP command
251 struct dump_cmd_struct
253 unsigned short cmd_status;
254 unsigned short cmd_cmd;
255 unsigned short cmd_link;
256 unsigned short dump_offset; /* pointeroffset to DUMP space */
260 * transmit command
262 struct transmit_cmd_struct
264 unsigned short cmd_status;
265 unsigned short cmd_cmd;
266 unsigned short cmd_link;
267 unsigned short tbd_offset; /* pointeroffset to TBD */
268 unsigned char dest[6]; /* destination address of the frame */
269 unsigned short length; /* user defined: 802.3 length / Ether type */
272 #define TCMD_ERRMASK 0x0fa0
273 #define TCMD_MAXCOLLMASK 0x000f
274 #define TCMD_MAXCOLL 0x0020
275 #define TCMD_HEARTBEAT 0x0040
276 #define TCMD_DEFERRED 0x0080
277 #define TCMD_UNDERRUN 0x0100
278 #define TCMD_LOSTCTS 0x0200
279 #define TCMD_NOCARRIER 0x0400
280 #define TCMD_LATECOLL 0x0800
282 struct tdr_cmd_struct
284 unsigned short cmd_status;
285 unsigned short cmd_cmd;
286 unsigned short cmd_link;
287 unsigned short status;
290 #define TDR_LNK_OK 0x8000 /* No link problem identified */
291 #define TDR_XCVR_PRB 0x4000 /* indicates a transceiver problem */
292 #define TDR_ET_OPN 0x2000 /* open, no correct termination */
293 #define TDR_ET_SRT 0x1000 /* TDR detected a short circuit */
294 #define TDR_TIMEMASK 0x07ff /* mask for the time field */
297 * Transmit Buffer Descriptor (TBD)
299 struct tbd_struct
301 unsigned short size; /* size + EOF-Flag(15) */
302 unsigned short next; /* pointeroffset to next TBD */
303 char *buffer; /* pointer to buffer */
306 #define TBD_LAST 0x8000 /* EOF-Flag, indicates last buffer in list */