source: rtems/c/src/lib/libbsp/m68k/mvme167/network/uti596.h @ 7dd6e8d

4.104.114.84.95
Last change on this file since 7dd6e8d was f05b2ac, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/21/04 at 16:01:48

Remove duplicate white lines.

  • Property mode set to 100644
File size: 9.6 KB
Line 
1
2/* uti596.h: Contains the defines and structures used by the uti596 driver */
3
4/*
5 * EII: March 11: Created v. 0.0
6 *
7 *  $Id$
8 */
9
10#ifndef UTI596_H
11#define UTI596_H
12#include <rtems/error.h>
13#include <rtems/rtems_bsdnet.h>
14
15#include <sys/param.h>
16#include <sys/mbuf.h>
17#include <sys/socket.h>
18#include <sys/sockio.h>
19
20#include <net/if.h>
21
22#include <netinet/in.h>
23#include <netinet/if_ether.h>
24
25/* Ethernet statistics */
26
27struct enet_statistics{
28  int   rx_packets;                                                     /* total packets received */
29  int   tx_packets;                                                     /* total packets transmitted */
30  int   rx_errors;                                                      /* bad packets received */
31  int   tx_errors;                                                      /* packet transmit problems     */
32  int   rx_dropped;                                                     /* no space in buffers */
33  int   tx_dropped;
34  int   tx_retries_exceeded;  /* excessive retries */
35  int   multicast;                                                      /* multicast packets received   */
36  int   collisions;
37
38  /* detailed rx_errors: */
39  int   rx_length_errors;
40  int   rx_over_errors;                                 /* receiver ring buff overflow  */
41  int   rx_crc_errors;                                  /* recved pkt with crc error    */
42  int   rx_frame_errors;                                /* recv'd frame alignment error */
43  int   rx_fifo_errors;                                 /* recv'r fifo overrun          */
44  int   rx_missed_errors;                               /* receiver missed packet       */
45
46  /* detailed tx_errors */
47  int   tx_aborted_errors;
48  int   tx_carrier_errors;
49  int   tx_fifo_errors;
50  int   tx_heartbeat_errors;
51  int   tx_window_errors;
52
53  /* NIC reset errors */
54  int   nic_reset_count;      /* The number of times uti596reset() has been called. */
55};
56
57#define CMD_EOL                                         0x8000          /* The last command of the list, stop. */
58#define CMD_SUSP                                        0x4000          /* Suspend after doing cmd.                                      */
59#define CMD_INTR                                        0x2000          /* Interrupt after doing cmd.                            */
60
61#define CMD_FLEX                                        0x0008          /* Enable flexible memory model   */
62
63#define SCB_STAT_CX             0x8000          /* Cmd completes with 'I' bit set */
64#define SCB_STAT_FR             0x4000          /* Frame Received                 */
65#define SCB_STAT_CNA            0x2000          /* Cmd unit Not Active            */
66#define SCB_STAT_RNR            0x1000          /* Receiver Not Ready             */
67
68#define SCB_CUS_SUSPENDED 0x0100
69#define SCB_CUS_ACTIVE    0x0200
70
71#define STAT_C                                          0x8000          /* Set to 1 after execution              */
72#define STAT_B                                          0x4000          /* 1 : Cmd being executed, 0 : Cmd done. */
73#define STAT_OK                                         0x2000          /* 1: Command executed ok 0 : Error      */
74#define STAT_A                                  0x1000          /* command has been aborted              */
75
76#define STAT_S11                0x0800
77#define STAT_S10                0x0400
78#define STAT_S9                 0x0200
79#define STAT_S8                 0x0100
80#define STAT_S7                 0x0080
81#define STAT_S6                 0x0040
82#define STAT_S5                 0x0020
83#define STAT_MAX_COLLS          0x000F
84
85#define RBD_STAT_P              0x4000          /* prefetch */
86#define RBD_STAT_F              0x4000          /* used */
87
88#define CUC_START                                       0x0100
89#define CUC_RESUME                              0x0200
90#define CUC_SUSPEND             0x0300
91#define CUC_ABORT                                       0x0400
92#define RX_START                                        0x0010
93#define RX_RESUME                                       0x0020
94#define RX_SUSPEND                              0x0030
95#define RX_ABORT                                        0x0040
96
97#define RU_SUSPENDED            0x0010
98#define RU_NO_RESOURCES         0x0020
99#define RU_READY                0x0040
100
101#define I596_NULL ( ( void * ) 0xffffffff)
102#define UTI_596_END_OF_FRAME 0x8000
103
104struct i596_tbd;  /* necessary forward declaration */
105
106enum commands {
107  CmdNOp           = 0,
108  CmdSASetup       = 1,
109  CmdConfigure     = 2,
110  CmdMulticastList = 3,
111  CmdTx            = 4,
112  CmdTDR           = 5,
113  CmdDump          = 6,
114  CmdDiagnose      = 7
115};
116
117/*
118 * 82596 Dump Command Result
119 */
120typedef volatile struct i596_dump_result {
121  unsigned char bf;
122  unsigned char config_bytes[11];
123  unsigned char reserved1[2];
124  unsigned char ia_bytes[6];
125  unsigned short last_tx_status;
126  unsigned short tx_crc_byte01;
127  unsigned short tx_crc_byte23;
128  unsigned short rx_crc_byte01;
129  unsigned short rx_crc_byte23;
130  unsigned short rx_temp_mem01;
131  unsigned short rx_temp_mem23;
132  unsigned short rx_temp_mem45;
133  unsigned short last_rx_status;
134  unsigned short hash_reg01;
135  unsigned short hash_reg23;
136  unsigned short hash_reg45;
137  unsigned short hash_reg67;
138  unsigned short slot_time_counter;
139  unsigned short wait_time_counter;
140  unsigned short rx_frame_length;
141  unsigned long reserved2;
142  unsigned long cb_in3;
143  unsigned long cb_in2;
144  unsigned long cb_in1;
145  unsigned long la_cb_addr;
146  unsigned long rdb_pointer;
147  unsigned long int_memory;
148  unsigned long rfd_size;
149  unsigned long tbd_pointer;
150  unsigned long base_addr;
151  unsigned long ru_temp_reg;
152  unsigned long tcb_count;
153  unsigned long next_rb_size;
154  unsigned long next_rb_addr;
155  unsigned long curr_rb_size;
156  unsigned long la_rbd_addr;
157  unsigned long next_rbd_addr;
158  unsigned long curr_rbd_addr;
159  unsigned long curr_rb_count;
160  unsigned long next_fd_addr;
161  unsigned long curr_fd_add;
162  unsigned long temp_cu_reg;
163  unsigned long next_tb_count;
164  unsigned long buffer_addr;
165  unsigned long la_tbd_addr;
166  unsigned long next_tbd_addr;
167  unsigned long cb_command;
168  unsigned long next_cb_addr;
169  unsigned long curr_cb_addr;
170  unsigned long scb_cmd_word;
171  unsigned long scb_pointer;
172  unsigned long cb_stat_word;
173  unsigned long mm_lfsr;
174  unsigned char micro_machine_bit_array[28];
175  unsigned char cu_port[16];
176  unsigned long mm_alu;
177  unsigned long reserved3;
178  unsigned long mm_temp_a_rr;
179  unsigned long mm_temp_a;
180  unsigned long tx_dma_b_cnt;
181  unsigned long mm_input_port_addr_reg;
182  unsigned long tx_dma_addr;
183  unsigned long mm_port_reg1;
184  unsigned long rx_dma_b_cnt;
185  unsigned long mm_port_reg2;
186  unsigned long rx_dma_addr;
187  unsigned long reserved4;
188  unsigned long bus_t_timers;
189  unsigned long diu_cntrl_reg;
190  unsigned long reserved5;
191  unsigned long sysbus;
192  unsigned long biu_cntrl_reg;
193  unsigned long mm_disp_reg;
194  unsigned long mm_status_reg;
195  unsigned short dump_status;
196} i596_dump_result;
197
198typedef volatile struct i596_selftest {
199  unsigned long rom_signature;
200  unsigned long results;
201} i596_selftest;
202
203/*
204 * Action commands
205 *   (big endian, linear mode)
206 */
207typedef volatile struct i596_cmd {
208  unsigned short status;
209  unsigned short command;
210  volatile struct i596_cmd *next;
211} i596_cmd;
212
213typedef volatile struct i596_nop {
214  i596_cmd cmd;
215} i596_nop;
216
217typedef volatile struct i596_set_add {
218  i596_cmd cmd;
219  char data[8];
220} i596_set_add;
221
222typedef volatile struct i596_configure {
223  i596_cmd cmd;
224  char data[16];
225} i596_configure;
226
227typedef volatile struct i596_tx {
228  i596_cmd cmd;
229  volatile struct i596_tbd *pTbd;
230  unsigned short count;
231  unsigned short pad;
232  char data[6];
233  unsigned short length;
234} i596_tx;
235
236typedef volatile struct i596_tdr {
237  i596_cmd cmd;
238  unsigned long data;
239} i596_tdr;
240
241typedef volatile struct i596_dump {
242  i596_cmd cmd;
243  char *pData;
244} i596_dump;
245
246/*
247 * Transmit buffer descriptor
248 */
249typedef volatile struct i596_tbd {
250          unsigned short size;
251          unsigned short pad;
252          volatile struct i596_tbd *next;
253          char *data;
254} i596_tbd;
255
256/*
257 * Receive buffer descriptor
258 *   (flexible memory structure)
259 */
260typedef volatile struct i596_rbd {
261          unsigned short count;
262          unsigned short offset;
263          volatile struct i596_rbd *next;
264          char *data;
265          unsigned short size;
266          unsigned short pad;
267} i596_rbd;
268
269/*
270 * Receive Frame Descriptor
271 */
272typedef volatile struct i596_rfd {
273          unsigned short stat;
274          unsigned short cmd;
275          volatile struct i596_rfd *next;
276          i596_rbd *pRbd;
277          unsigned short count;
278          unsigned short size;
279          char data [1532];
280} i596_rfd;
281
282/*
283 * System Control Block
284 */
285typedef volatile struct i596_scb {
286          unsigned short status;
287          unsigned short command;
288          unsigned long cmd_pointer;
289          unsigned long rfd_pointer;
290          unsigned long crc_err;
291          unsigned long align_err;
292          unsigned long resource_err;
293          unsigned long over_err;
294          unsigned long rcvdt_err;
295          unsigned long short_err;
296          unsigned short t_off;
297          unsigned short t_on;
298          i596_cmd *pCmd;
299          i596_rfd *pRfd;
300} i596_scb;
301
302/*
303 * Intermediate System Configuration Pointer
304 */
305typedef volatile struct i596_iscp {
306    uint8_t   null1;                                    /* Always zero */
307    uint8_t   busy;                                                                             /* Busy byte */
308    unsigned short scb_offset;                          /* Not used in linear mode */
309    unsigned long scb_pointer;          /* Swapped pointer to scb */
310    i596_scb *scb;                                                                              /* Real pointer to scb */
311} i596_iscp;
312
313/*
314 * System Configuration Pointer
315 */
316typedef volatile struct i596_scp {
317    unsigned long sysbus;                                                       /* Only low 8 bits are used */
318    unsigned long pad;                                                          /* Must be zero */
319    unsigned long iscp_pointer;       /* Swapped pointer to iscp */
320    i596_iscp *iscp;                                                                    /* Real pointer to iscp */
321} i596_scp;
322
323/*
324 * Device Dependent Data Structure
325 */
326typedef volatile struct uti596_softc {
327  struct arpcom arpcom;
328  i596_scp *pScp;                                                                                       /* Block aligned on 16 byte boundary */
329  i596_scp *base_scp;                 /* Unaligned block. Need for free() */
330  i596_iscp iscp;
331  i596_scb scb;
332  i596_set_add set_add;
333  i596_configure set_conf;
334  i596_tdr tdr;
335  i596_nop nop;
336  i596_tx  *pTxCmd;
337  i596_tbd *pTbd;
338
339  i596_rfd *pBeginRFA;
340  i596_rfd *pEndRFA;
341  i596_rfd *pLastUnkRFD;
342  i596_rbd *pLastUnkRBD;
343  i596_rfd *pEndSavedQueue;
344  i596_cmd *pCmdHead;
345  i596_cmd *pCmdTail;                           /* unneeded, as chaining not used, but implemented */
346
347  rtems_id rxDaemonTid;
348  rtems_id txDaemonTid;
349  rtems_id resetDaemonTid;
350
351  struct enet_statistics stats;
352  int started;
353  unsigned long rxInterrupts;
354  unsigned long txInterrupts;
355  volatile int cmdOk;
356  unsigned short * pCurrent_command_status;
357  int resetDone;
358  unsigned long txRawWait;
359  i596_rfd *pInboundFrameQueue;
360  short int rxBdCount;
361  short int txBdCount;
362  short int countRFD;
363  short int savedCount;
364  i596_rfd *pSavedRfdQueue;
365  rtems_name semaphore_name;
366  rtems_id semaphore_id;
367  char zeroes[64];
368  unsigned long rawsndcnt;
369  int nic_reset;  /* flag for requesting that ISR issue a reset quest */
370} uti596_softc_;
371
372#endif /* UTI596_H */
Note: See TracBrowser for help on using the repository browser.