OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [lib/] [libbsp/] [i386/] [i386ex/] [network/] [uti596.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
 
2
/* uti596.h: Contains the defines and structures used by the uti596 driver */
3
 
4
/*
5
 * EII: March 11: Created v. 0.0
6
 *      Jan 12/98 Added STAT bits, s11-=s5 and max_colls.
7
 *
8
 *  uti596.h,v 1.2 1999/01/20 18:55:50 joel Exp
9
 */
10
 
11
#ifndef UTI596_H
12
#define UTI596_H
13
#include <rtems/error.h>
14
#include <rtems/rtems_bsdnet.h>
15
 
16
#include <sys/param.h>
17
#include <sys/mbuf.h>
18
#include <sys/socket.h>
19
#include <sys/sockio.h>
20
 
21
#include <net/if.h>
22
 
23
#include <netinet/in.h>
24
#include <netinet/if_ether.h>
25
 
26
/* Ethernet statistics */
27
 
28
struct enet_statistics{
29
  int   rx_packets;                     /* total packets received       */
30
  int   tx_packets;                     /* total packets transmitted    */
31
  int   rx_errors;                      /* bad packets received         */
32
  int   tx_errors;                      /* packet transmit problems     */
33
  int   rx_dropped;                     /* no space in buffers          */
34
  int   tx_dropped;                     /*                              */
35
  int   tx_retries_exceeded;              /* excessive retries            */
36
  int   multicast;                      /* multicast packets received   */
37
  int   collisions;
38
 
39
  /* detailed rx_errors: */
40
  int   rx_length_errors;
41
  int   rx_over_errors;                 /* receiver ring buff overflow  */
42
  int   rx_crc_errors;                  /* recved pkt with crc error    */
43
  int   rx_frame_errors;                /* recv'd frame alignment error */
44
  int   rx_fifo_errors;                 /* recv'r fifo overrun          */
45
  int   rx_missed_errors;               /* receiver missed packet       */
46
 
47
  /* detailed tx_errors */
48
  int   tx_aborted_errors;
49
  int   tx_carrier_errors;
50
  int   tx_fifo_errors;
51
  int   tx_heartbeat_errors;
52
  int   tx_window_errors;
53
 
54
  /* NIC reset errors */
55
  int   nic_reset_count;      /* The number of times uti596reset() has been called. */
56
};
57
 
58
 
59
 
60
enum commands {
61
  CmdNOp           = 0,
62
  CmdSASetup       = 1,
63
  CmdConfigure     = 2,
64
  CmdMulticastList = 3,
65
  CmdTx            = 4,
66
  CmdTDR           = 5,
67
  CmdDump          = 6,
68
  CmdDiagnose      = 7
69
};
70
 
71
 
72
#define UTI596_MUTEX   1
73
 
74
 
75
#define CMD_EOL         0x8000  /* The last command of the list, stop. */
76
#define CMD_SUSP        0x4000  /* Suspend after doing cmd. */
77
#define CMD_INTR        0x2000  /* Interrupt after doing cmd. */
78
 
79
#define CMD_FLEX        0x0008  /* Enable flexible memory model */
80
 
81
#define SCB_STAT_CX     0x8000  /* Cmd completes with 'I' bit set */
82
#define SCB_STAT_FR     0x4000  /* Frame Received                 */
83
#define SCB_STAT_CNA    0x2000  /* Cmd unit Not Active            */
84
#define SCB_STAT_RNR    0x1000  /* Receiver Not Ready             */
85
 
86
#define SCB_CUS_SUSPENDED 0x0100
87
#define SCB_CUS_ACTIVE    0x0200
88
 
89
 
90
#define STAT_C          0x8000  /* Set to 1 after execution              */
91
#define STAT_B          0x4000  /* 1 : Cmd being executed, 0 : Cmd done. */
92
#define STAT_OK         0x2000  /* 1: Command executed ok 0 : Error      */
93
#define STAT_A          0x1000  /* command has been aborted              */
94
 
95
#define STAT_S11        0x0800
96
#define STAT_S10        0x0400
97
#define STAT_S9         0x0200
98
#define STAT_S8         0x0100
99
#define STAT_S7         0x0080
100
#define STAT_S6         0x0040
101
#define STAT_S5         0x0020
102
#define STAT_MAX_COLLS  0x000F
103
 
104
 
105
#define RBD_STAT_P      0x4000  /* prefetch */
106
#define RBD_STAT_F      0x4000  /* used */
107
 
108
#define  CUC_START      0x0100
109
#define  CUC_RESUME     0x0200
110
#define  CUC_SUSPEND    0x0300
111
#define  CUC_ABORT      0x0400
112
#define  RX_START       0x0010
113
#define  RX_RESUME      0x0020
114
#define  RX_SUSPEND     0x0030
115
#define  RX_ABORT       0x0040
116
 
117
#define  RU_SUSPENDED    0x0010
118
#define  RU_NO_RESOURCES 0x0020
119
#define  RU_READY        0x0040
120
 
121
 
122
#define IO_ADDR         0x360
123
#define PORT_ADDR       IO_ADDR
124
#define CHAN_ATTN       PORT_ADDR + 4
125
#define NIC_ADDR        PORT_ADDR + 8
126
 
127
struct i596_cmd {
128
    volatile unsigned short status;
129
    volatile unsigned short command;
130
    struct i596_cmd *next;
131
};
132
 
133
#define I596_NULL ( ( void * ) 0xffffffff)
134
#define UTI_596_END_OF_FRAME            0x8000
135
#define SIZE_MASK       0x3fff
136
 
137
/*
138
 * Transmit buffer Descriptor
139
 */
140
 
141
struct i596_tbd {
142
    unsigned short size;
143
    unsigned short pad;
144
    struct i596_tbd *next;
145
    char *data;
146
};
147
 
148
/*
149
 * Receive buffer Descriptor
150
 */
151
 
152
struct i596_rbd {
153
    unsigned short count;
154
    unsigned short offset;
155
    struct i596_rbd *next;
156
    char           *data;
157
    unsigned short size;
158
    unsigned short pad;
159
};
160
 
161
/*
162
 * Transmit Command Structure
163
 */
164
struct tx_cmd {
165
    struct i596_cmd cmd;
166
    struct i596_tbd *pTbd;
167
    unsigned short size;
168
    unsigned short pad;
169
} ;
170
 
171
 
172
/*
173
 * Receive Frame Descriptor
174
 */
175
struct i596_rfd {
176
    volatile unsigned short stat;
177
    volatile unsigned short cmd;
178
    struct i596_rfd *next;
179
    struct i596_rbd *pRbd;
180
    unsigned short count;
181
    unsigned short size;
182
    char data [1532 ];
183
} ;
184
 
185
 
186
struct i596_dump {
187
  struct i596_cmd cmd;
188
  char * pData;
189
};
190
 
191
struct i596_set_add {
192
  struct i596_cmd cmd;
193
  char   data[8];
194
};
195
 
196
struct i596_configure {
197
  struct i596_cmd cmd;
198
  char   data[16];
199
};
200
 
201
struct i596_nop {
202
  struct i596_cmd cmd;
203
};
204
 
205
struct i596_tdr {
206
  struct i596_cmd cmd;
207
  unsigned int data;
208
};
209
 
210
#define RX_RING_SIZE 8
211
 
212
/*
213
 * System Control Block
214
 */
215
struct i596_scb {
216
    volatile unsigned short status;
217
    volatile unsigned short command;
218
    struct i596_cmd *pCmd;
219
    struct i596_rfd *pRfd;
220
    volatile unsigned long crc_err;
221
    volatile unsigned long align_err;
222
    volatile unsigned long resource_err;
223
    volatile unsigned long over_err;
224
    volatile unsigned long rcvdt_err;
225
    volatile unsigned long short_err;
226
    volatile unsigned short t_on;
227
    volatile unsigned short t_off;
228
};
229
 
230
 
231
/*
232
 * Intermediate System Control Block
233
 */
234
struct i596_iscp {
235
    volatile unsigned long stat;
236
    struct i596_scb *scb;
237
} ;
238
/*
239
 * System Control Parameters
240
 */
241
struct i596_scp {
242
    unsigned long sysbus;
243
    unsigned long pad;
244
    struct i596_iscp *iscp;
245
} ;
246
 
247
struct uti596_softc {
248
  struct arpcom                 arpcom;
249
  rtems_irq_connect_data        irqInfo;
250
  struct i596_scp              *pScp;
251
  struct i596_iscp              iscp;
252
  struct i596_scb               scb;
253
  struct i596_set_add           set_add;
254
  struct i596_configure         set_conf;
255
  struct i596_tdr               tdr;
256
  struct i596_nop               nop;
257
  unsigned long                 stat;
258
  struct tx_cmd                *pTxCmd;
259
  struct i596_tbd              *pTbd;
260
 
261
  int                   ioAddr;
262
 
263
  struct i596_rfd     *pBeginRFA;
264
  struct i596_rfd     *pEndRFA;
265
  struct i596_rfd     *pLastUnkRFD;
266
  struct i596_rbd     *pLastUnkRBD;
267
  struct i596_rfd     *pEndSavedQueue;
268
  struct i596_cmd     *pCmdHead;
269
  struct i596_cmd     *pCmdTail;  /* unneeded, as chaining not used, but implemented */
270
 
271
  rtems_id              rxDaemonTid;
272
  rtems_id              txDaemonTid;
273
  rtems_id              resetDaemonTid;
274
 
275
  struct enet_statistics stats;
276
  int                  started;
277
  unsigned long        rxInterrupts;
278
  unsigned long        txInterrupts;
279
  volatile int         cmdOk;
280
  int                  resetDone;
281
  unsigned long        txRawWait;
282
  struct i596_rfd     *pInboundFrameQueue;
283
  short int            rxBdCount;
284
  short int            txBdCount;
285
  short int            countRFD;
286
  short int            savedCount;
287
  struct i596_rfd     *pSavedRfdQueue;
288
  rtems_name           semaphore_name;
289
  rtems_id             semaphore_id;
290
  char                 zeroes[64];
291
  unsigned long        rawsndcnt;
292
  int                  nic_reset; /* flag is for requesting that ISR issue a reset quest */
293
} ;
294
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.