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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [ppcn_60x/] [network/] [amd79c970.h] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  COPYRIGHT (c) 1998 by Radstone Technology
3
 *
4
 *
5
 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY
6
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
7
 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
8
 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU.
9
 *
10
 * You are hereby granted permission to use, copy, modify, and distribute
11
 * this file, provided that this notice, plus the above copyright notice
12
 * and disclaimer, appears in all copies. Radstone Technology will provide
13
 * no support for this code.
14
 *
15
 */
16
#ifndef _PCNET_H
17
#define _PCNET_H
18
 
19
/*
20
 * IO space structure for the AMD79C970 device
21
 */
22
 
23
typedef volatile struct pc_net
24
{
25
        union
26
        {
27
                struct {
28
                        unsigned16      aprom[8];  /* 0x00 */
29
                        unsigned16      rdp;       /* 0x10 */
30
                        unsigned16      rap;       /* 0x14 */
31
                        unsigned16      reset;     /* 0x18 */
32
                        unsigned16      bdp;       /* 0x1C */
33
                } wio;
34
                struct {
35
                        unsigned32      aprom[4];  /* 0x00 */
36
                        unsigned32      rdp;       /* 0x10 */
37
                        unsigned32      rap;       /* 0x12 */
38
                        unsigned32      reset;     /* 0x14 */
39
                        unsigned32      bdp;       /* 0x16 */
40
                } dwio;
41
        } u;
42
} pc_net_t;
43
 
44
/*
45
 * The EEPROM is 2Kbit (128bytes)
46
 */
47
#define EEPROM_SIZE 128
48
#define EEPROM_HEAD_SIZE 36
49
 
50
typedef struct pc_net_eeprom {
51
        unsigned8       EthNumber[6];
52
        unsigned16      Reserved1;      /* Must be 0x0000 */
53
        unsigned16      Reserved2;      /* Must be 0x1000 */
54
        unsigned16      User1;
55
        unsigned16      checksum;
56
        unsigned16      Reserved3;      /* Must be 0x5757 */
57
        unsigned16      bcr16;
58
        unsigned16      bcr17;
59
        unsigned16      bcr18;
60
        unsigned16      bcr2;
61
        unsigned16      bcr21;
62
        unsigned16      Reserved4;      /* Must be 0x0000 */
63
        unsigned16      Reserved5;      /* Must be 0x0000 */
64
        unsigned8       Reserved6;      /* Must be 0x00 */
65
        unsigned8       checksumAdjust;
66
        unsigned16      Reserved7;      /* Must be 0x0000 */
67
        unsigned16      crc;            /* CCITT checksum from Serial[] onwards */
68
        unsigned8       Serial[16];     /* Radstone Serial Number */
69
} pc_net_eeprom_t;
70
 
71
/*
72
 * PCnet-PCI Single Chip Ethernet Controller for PCI Local Bus
73
 */
74
/*
75
 * Register and bit definitions
76
 */
77
 
78
#define CSR0    0
79
#define CSR1    1
80
#define CSR2    2
81
#define CSR3    3
82
#define CSR4    4
83
#define CSR5    5
84
#define CSR6    6
85
#define CSR7    7
86
#define CSR8    8
87
#define CSR9    9
88
#define CSR15   15
89
#define CSR47   47
90
#define CSR82   82      /* Bus Activity Timer */
91
#define CSR100  100     /* Memory Error Timeout register */
92
#define CSR114  114
93
#define CSR122  122     /* Receiver Packet Alignment Register */
94
 
95
#define BCR2    2       /* Misc. Configuration */
96
#define BCR18   18      /* Bus size and burst control */
97
#define DEFAULT_BCR18 0x2162 /* default BCR18 value - was 0x21e2*/
98
#define BCR19   19
99
#define BCR20   20      /* Software Style */
100
#define BCR21   21
101
 
102
#define APROM0  0x00
103
#define APROM1  0x04
104
#define APROM2  0x08
105
 
106
/*
107
 * CSR0: Bit definitions
108
 */
109
#define CSR0_ERR        0x8000  /* error summary */
110
#define CSR0_BABL       0x4000  /* babble error */
111
#define CSR0_CERR       0x2000  /* collision error */
112
#define CSR0_MISS       0x1000  /* missed packet */
113
#define CSR0_MERR       0x0800  /* memory error */
114
#define CSR0_RINT       0x0400  /* receiver interrupt */
115
#define CSR0_TINT       0x0200  /* transmitter interrupt */
116
#define CSR0_IDON       0x0100  /* initialization done */
117
#define CSR0_INTR       0x0080  /* interrupt flag */
118
#define CSR0_IENA       0x0040  /* interrupt enable */
119
#define CSR0_RXON       0x0020  /* receiver on */
120
#define CSR0_TXON       0x0010  /* transmitter on */
121
#define CSR0_TDMD       0x0008  /* transmit demand */
122
#define CSR0_STOP       0x0004  /* stop the ilacc */
123
#define CSR0_STRT       0x0002  /* start the ilacc */
124
#define CSR0_INIT       0x0001  /* initialize the ilacc */
125
 
126
#define CSR3_BABLM      0x4000  /* BABL Mask */
127
#define CSR3_MISSM      0x1000  /* Missed packet Mask */
128
#define CSR3_MERRM      0x0800  /* Memory error Mask */
129
#define CSR3_RINTM      0x0400  /* Receive Interrupt Mask */
130
#define CSR3_TINTM      0x0200  /* Transmit Interrupt Mask */
131
#define CSR3_IDONM      0x0100  /* Initialization Done Mask */
132
#define CSR3_DXSUFLO    0x0040  /* Disable tx stop on underrun */
133
#define CSR3_LAPPEN     0x0020  /* lookahead packet proc enable */
134
#define CSR3_DXMT2PD    0x0010  /* disable 2 part deferral */
135
#define CSR3_EMBA       0x0008  /* enable modified backoff */
136
#define CSR3_BSWP       0x0004  /* byte swap */
137
 
138
#define CSR4_DMAPLUS    0x4000  /* DMA burst transfer until FIFO empty */
139
#define CSR4_BACON_68K  0x0040  /* 32 bit 680x0 */
140
#define CSR4_TXSTRT     0x0008  /* Transmit STaRT status */
141
#define CSR4_TXSTRTM    0x0004  /* Transmit STaRT interrupt Mask  */
142
#define CSR4_ENTST      0x8000  /* enable test mode */
143
#define CSR4_TIMER      0x2000  /* enable bus timer csr82 */
144
#define CSR4_DPOLL      0x1000  /* disable tx polling */
145
#define CSR4_APADXMIT   0x0800  /* auto pad tx to 64 */
146
#define CSR4_ASTRPRCV   0x0400  /* auto strip rx pad and fcs */
147
#define CSR4_MFCO       0x0200  /* missed frame counter oflo interrupt */
148
#define CSR4_MFCOM      0x0100  /* mask to disable */
149
#define CSR4_RCVCCO     0x0020  /* rx collision counter oflo interrupt */
150
#define CSR4_RCVCCOM    0x0010  /* mask to disable */
151
#define CSR4_JAB        0x0002  /* jabber error 10baseT interrupt */
152
#define CSR4_JABM       0x0001  /* mask to disable */
153
 
154
#define CSR5_SPND       0x0001  /* Suspend */
155
 
156
#define CSR15_PROM      0x8000  /* Promiscuous */
157
#define CSR15_DRCVBC    0x4000  /* Disable receiver broadcast */
158
#define CSR15_DRCVPA    0x2000  /* Disable receiver phys. addr. */
159
#define CSR15_DLNKTST   0x1000  /* Disable link status */
160
#define CSR15_DAPC      0x0800  /* Disable auto polarity det. */
161
#define CSR15_MENDECL   0x0400  /* MENDEC loopback mode */
162
#define CSR15_LRT       0x0200  /* Low receiver threshold */
163
#define CSR15_TSEL      0x0200  /* Transmit mode select */
164
#define CSR15_INTL      0x0040  /* Internal loopback */
165
#define CSR15_DRTY      0x0020  /* Disable retry */
166
#define CSR15_FCOLL     0x0010  /* Force collision */
167
#define CSR15_DXMTFCS   0x0008  /* Disable transmit CRC */
168
#define CSR15_LOOP      0x0004  /* Loopback enable */
169
#define CSR15_DTX       0x0002  /* Disable transmitter */
170
#define CSR15_DRX       0x0001  /* Disable receiver */
171
 
172
#define CSR58_PCISTYLE  0x0002  /* software style */
173
 
174
#define CSR80_RCVFW16   (0<<12) /* fifo level to trigger rx dma */
175
#define CSR80_RCVFW32   (1<<12)
176
#define CSR80_RCVFW64   (2<<12)
177
#define CSR80_XMTSP4    (0<<10) /* fifo level to trigger tx */
178
#define CSR80_XMTSP16   (1<<10)
179
#define CSR80_XMTSP64   (2<<10)
180
#define CSR80_XMTSP112  (3<<10)
181
#define CSR80_XMTFW16   (0<<8)  /* fifo level to stop dma */
182
#define CSR80_XMTFW32   (1<<8)
183
#define CSR80_XMTFW64   (2<<8)
184
/* must also clear csr4 CSR4_DMAPLUS: */
185
#define CSR80_DMATC(x)  ((x)&0xff)      /* max transfers per burst. deflt 16 */
186
/*
187
 * must also set csr4 CSR4_TIMER:
188
 */
189
#define CSR82_DMABAT(x) ((x)&0xffff)    /* max burst time nanosecs*100 */
190
 
191
#define BCR18_MUSTSET   0x0100  /* this bit must be written as 1 !! */
192
#define BCR18_BREADE    0x0040  /* linear burst enable. yes ! on pci */
193
#define BCR18_BWRITE    0x0020  /* in write direction */
194
#define BCR18_LINBC4    0x0001  /* linear burst count 4 8 or 16 */
195
#define BCR18_LINBC8    0x0002  /* NOTE LINBC must be <= fifo trigger*/
196
#define BCR18_LINBC16   0x0004
197
 
198
#define BCR19_PVALID    0x8000  /* aprom (eeprom) read checksum ok */
199
 
200
/*
201
 * initial setting of csr0
202
 */
203
#define CSR0_IVALUE     (CSR0_IDON | CSR0_IENA | CSR0_STRT | CSR0_INIT)
204
 
205
/*
206
 * our setting of csr3
207
 */
208
#define CSR3_VALUE      (CSR3_ACON | CSR3_BSWP)
209
 
210
/*
211
 * Initialization Block.
212
 *      Chip initialization includes the reading of the init block to obtain
213
 *      the operating parameters.
214
 *
215
 * This essentially consists of 7, 32 bit LE words. In the following the
216
 * fields are ordered so that they map correctly in BE mode, however each
217
 * 16 and 32 byte field will require swapping.
218
 */
219
 
220
typedef volatile struct initblk {
221
        /* mode can be set in csr15 */
222
        unsigned16      ib_mode;        /* Chip's operating parameters */
223
        unsigned8       ib_rlen;        /* rx ring length (power of 2) */
224
        unsigned8       ib_tlen;        /* tx ring length (power of 2) */
225
/*
226
 * The bytes must be swapped within the word, so that, for example,
227
 * the address 8:0:20:1:25:5a is written in the order
228
 *             0 8 1 20 5a 25
229
 * For PCI970 that is long word swapped: so no swapping needed, since
230
 * the bus will swap.
231
 */
232
        unsigned8       ib_padr[8];     /* physical address */
233
        unsigned16      ib_ladrf[4];    /* logical address filter */
234
        unsigned32      ib_rdra;        /* rcv ring desc addr */
235
        unsigned32      ib_tdra;        /* xmit ring desc addr */
236
} initblk_t;
237
 
238
 
239
/*
240
 * bits in mode register: allows alteration of the chips operating parameters
241
 */
242
#define IBM_PROM        0x8000  /* promiscuous mode */
243
/*
244
 * mode is also in cr15
245
 */
246
#define MODE_DRCVBC     0x4000  /* disable receive broadcast */
247
#define MODE_DRCVPA     0x2000  /* disable receive physical address */
248
#define MODE_DLNKTST    0x1000  /* disable link status monitoring 10T */
249
#define MODE_DAPC       0x0800  /* disable auto polarity 10T */
250
#define MODE_MENDECL    0x0400  /* mendec loopback */
251
#define MODE_LRT        0x0200  /* low receive threshold/tx mode sel tmau */
252
#define MODE_PORTSEL10T 0x0080  /* port select 10T ?? */
253
#define MODE_PORTSELAUI 0x0000  /* port select aui ?? */
254
#define IBM_INTL        0x0040  /* internal loopback */
255
#define IBM_DRTY        0x0020  /* disable retry */
256
#define IBM_COLL        0x0010  /* force collision */
257
#define IBM_DTCR        0x0008  /* disable transmit crc */
258
#define IBM_LOOP        0x0004  /* loopback */
259
#define IBM_DTX         0x0002  /* disable transmitter */
260
#define IBM_DRX         0x0001  /* disable receiver */
261
 
262
/*
263
 * Buffer Management is accomplished through message descriptors organized
264
 * in ring structures in main memory. There are two rings allocated for the
265
 * device: a receive ring and a transmit ring. The following defines the
266
 * structure of the descriptor rings.
267
 */
268
 
269
/*
270
 *                  Receive  List type definition
271
 *
272
 * This essentially consists of 4, 32 bit LE words. In the following the
273
 * fields are ordered so that they map correctly in BE mode, however each
274
 * 16 and 32 byte field will require swapping.
275
 */
276
 
277
typedef volatile struct rmde {
278
        unsigned32      rmde_addr;      /* buf addr */
279
 
280
        unsigned16      rmde_bcnt;
281
        unsigned16      rmde_flags;
282
 
283
        unsigned16      rmde_mcnt;
284
        unsigned16      rmde_misc;
285
 
286
        unsigned32      align;
287
} rmde_t;
288
 
289
 
290
/*
291
 * bits in the flags field
292
 */
293
#define RFLG_OWN        0x8000  /* ownership bit, 1==LANCE */
294
#define RFLG_ERR        0x4000  /* error summary */
295
#define RFLG_FRAM       0x2000  /* framing error */
296
#define RFLG_OFLO       0x1000  /* overflow error */
297
#define RFLG_CRC        0x0800  /* crc error */
298
#define RFLG_BUFF       0x0400  /* buffer error */
299
#define RFLG_STP        0x0200  /* start of packet */
300
#define RFLG_ENP        0x0100  /* end of packet */
301
 
302
/*
303
 * bits in the buffer byte count field
304
 */
305
#define RBCNT_ONES      0xf000  /* must be ones */
306
#define RBCNT_BCNT      0x0fff  /* buf byte count, in 2's compl */
307
 
308
/*
309
 * bits in the message byte count field
310
 */
311
#define RMCNT_RES       0xf000  /* reserved, read as zeros */
312
#define RMCNT_BCNT      0x0fff  /* message byte count */
313
 
314
/*
315
 *                  Transmit List type definition
316
 *
317
 * This essentially consists of 4, 32 bit LE words. In the following the
318
 * fields are ordered so that they map correctly in BE mode, however each
319
 * 16 and 32 byte field will require swapping.
320
 */
321
typedef volatile struct tmde {
322
        unsigned32      tmde_addr;      /* buf addr */
323
 
324
        unsigned16      tmde_bcnt;
325
        unsigned16      tmde_status;    /* misc error and status bits */
326
 
327
        unsigned32      tmde_error;
328
 
329
        unsigned32      align;
330
} tmde_t;
331
 
332
/*
333
 * bits in the status field
334
 */
335
#define TST_OWN         0x8000  /* ownership bit, 1==LANCE */
336
#define TST_ERR         0x4000  /* error summary */
337
#define TST_RES         0x2000  /* reserved bit */
338
#define TST_MORE        0x1000  /* more than one retry was needed */
339
#define TST_ONE         0x0800  /* one retry was needed */
340
#define TST_DEF         0x0400  /* defer while trying to transmit */
341
#define TST_STP         0x0200  /* start of packet */
342
#define TST_ENP         0x0100  /* end of packet */
343
 
344
/*
345
 * setting of status field when packet is to be transmitted
346
 */
347
#define TST_XMIT        (TST_STP | TST_ENP | TST_OWN)
348
 
349
/*
350
 * bits in the buffer byte count field
351
 */
352
#define TBCNT_ONES      0xf000  /* must be ones */
353
#define TBCNT_BCNT      0x0fff  /* buf byte count, in 2's compl */
354
 
355
/*
356
 * bits in the error field
357
 */
358
#define TERR_BUFF       0x8000  /* buffer error */
359
#define TERR_UFLO       0x4000  /* underflow error */
360
#define TERR_EXDEF      0x2000  /* excessive deferral */
361
#define TERR_LCOL       0x1000  /* late collision */
362
#define TERR_LCAR       0x0800  /* loss of carrier */
363
#define TERR_RTRY       0x0400  /* retry error */
364
#define TERR_TDR        0x03ff  /* time domain reflectometry */
365
 
366
/*
367
 * Defines pertaining to statistics gathering (diagnostic only)
368
 */
369
 
370
/*
371
 * receive errors
372
 */
373
#define ERR_FRAM        0        /* framing error */
374
#define ERR_OFLO        1       /* overflow error */
375
#define ERR_CRC         2       /* crc error */
376
#define ERR_RBUFF       3       /* receive buffer error */
377
 
378
/*
379
 * transmit errors
380
 */
381
#define ERR_MORE        4       /* more than one retry */
382
#define ERR_ONE         5       /* one retry */
383
#define ERR_DEF         6       /* defer'd packet */
384
#define ERR_TBUFF       7       /* transmit buffer error */
385
#define ERR_UFLO        8       /* underflow error */
386
#define ERR_LCOL        9       /* late collision */
387
#define ERR_LCAR        10      /* loss of carrier */
388
#define ERR_RTRY        11      /* retry error, >16 retries */
389
 
390
/*
391
 * errors reported in csr0
392
 */
393
#define ERR_BABL        12      /* transmitter timeout error */
394
#define ERR_MISS        13      /* missed packet */
395
#define ERR_MEM         14      /* memory error */
396
#define ERR_CERR        15      /* collision errors */
397
#define XMIT_INT        16      /* transmit interrupts */
398
#define RCV_INT         17      /* receive interrupts */
399
 
400
#define NHARD_ERRORS    18      /* error types used in diagnostic */
401
 
402
/*
403
 * other statistics
404
 */
405
#define ERR_TTOUT       18      /* transmit timeouts */
406
#define ERR_ITOUT       19      /* init timeouts */
407
#define ERR_INITS       20      /* reinitializations */
408
#define ERR_RSILO       21      /* silo ptrs misaligned on recv */
409
#define ERR_TSILO       22      /* silo ptrs misaligned on xmit */
410
#define ERR_SINTR       23      /* spurious interrupts */
411
 
412
#define NUM_ERRORS      24      /* number of errors types */
413
 
414
/*
415
 * Bit definitions for BCR19
416
 */
417
#define prom_EDI        (unsigned16)0x0001
418
#define prom_EDO        (unsigned16)0x0001
419
#define prom_ESK        (unsigned16)0x0002
420
#define prom_ECS        (unsigned16)0x0004
421
#define prom_EEN        (unsigned16)0x0010
422
#define prom_EEDET      (unsigned16)0x2000
423
#define prom_PVALID     (unsigned16)0x8000
424
#define prom_PREAD      (unsigned16)0x4000
425
 
426
#endif

powered by: WebSVN 2.1.0

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