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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [devs/] [eth/] [powerpc/] [ppc405/] [current/] [src/] [ppc405_enet.h] - Blame information for rev 810

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      ppc405.h
4
//
5
//      PowerPC PPC405GP Ethernet
6
//
7
//==========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
9
// -------------------------------------------                              
10
// This file is part of eCos, the Embedded Configurable Operating System.   
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under    
14
// the terms of the GNU General Public License as published by the Free     
15
// Software Foundation; either version 2 or (at your option) any later      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
//==========================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):    gthomas
43
// Contributors: gthomas
44
// Date:         2003-08-15
45
// Purpose:      
46
// Description:  
47
//              
48
//
49
//####DESCRIPTIONEND####
50
//
51
//==========================================================================
52
 
53
// PowerPC PPC405 Ethernet
54
 
55
//
56
// Ethernet MAC controller registers
57
//
58
#define EMAC0_MR0   *(volatile unsigned long *)0xEF600800
59
#define EMAC0_MR1   *(volatile unsigned long *)0xEF600804
60
#define EMAC0_TMR0  *(volatile unsigned long *)0xEF600808
61
#define EMAC0_TMR1  *(volatile unsigned long *)0xEF60080C
62
#define EMAC0_RMR   *(volatile unsigned long *)0xEF600810
63
#define EMAC0_ISR   *(volatile unsigned long *)0xEF600814
64
#define EMAC0_ISER  *(volatile unsigned long *)0xEF600818
65
#define EMAC0_IAHR  *(volatile unsigned long *)0xEF60081C
66
#define EMAC0_IALR  *(volatile unsigned long *)0xEF600820
67
#define EMAC0_VTPID *(volatile unsigned long *)0xEF600824
68
#define EMAC0_VTCI  *(volatile unsigned long *)0xEF600828
69
#define EMAC0_PRT   *(volatile unsigned long *)0xEF60082C
70
#define EMAC0_IAHT1 *(volatile unsigned long *)0xEF600830
71
#define EMAC0_IAHT2 *(volatile unsigned long *)0xEF600834
72
#define EMAC0_IAHT3 *(volatile unsigned long *)0xEF600838
73
#define EMAC0_IAHT4 *(volatile unsigned long *)0xEF60083C
74
#define EMAC0_GAHT1 *(volatile unsigned long *)0xEF600840
75
#define EMAC0_GAHT2 *(volatile unsigned long *)0xEF600844
76
#define EMAC0_GAHT3 *(volatile unsigned long *)0xEF600848
77
#define EMAC0_GAHT4 *(volatile unsigned long *)0xEF60084C
78
#define EMAC0_LSAH  *(volatile unsigned long *)0xEF600850
79
#define EMAC0_LSAL  *(volatile unsigned long *)0xEF600854
80
#define EMAC0_IPGVR *(volatile unsigned long *)0xEF600858
81
#define EMAC0_STACR *(volatile unsigned long *)0xEF60085C
82
#define EMAC0_TRTR  *(volatile unsigned long *)0xEF600860
83
#define EMAC0_RWMR  *(volatile unsigned long *)0xEF600864
84
#define EMAC0_OCTX  *(volatile unsigned long *)0xEF600868
85
#define EMAC0_OCRX  *(volatile unsigned long *)0xEF60086C
86
 
87
//
88
// Mode Register 0
89
//
90
#define EMAC0_MR0_RXI  0x80000000  // RX MAC Idle (1 = RX is idle)
91
#define EMAC0_MR0_TXI  0x40000000  // TX MAC Idle (1 = TX is idle)
92
#define EMAC0_MR0_SRST 0x20000000
93
#define EMAC0_MR0_TXE  0x10000000
94
#define EMAC0_MR0_RXE  0x08000000
95
#define EMAC0_MR0_WKE  0x04000000
96
 
97
//
98
// Mode Register 1
99
//
100
#define EMAC0_MR1_FDE  0x80000000
101
#define EMAC0_MR1_ILE  0x40000000
102
#define EMAC0_MR1_VLE  0x20000000
103
#define EMAC0_MR1_EIFC 0x10000000
104
#define EMAC0_MR1_APP  0x08000000
105
#define EMAC0_MR1_IST  0x01000000
106
#define EMAC0_MR1_MF   0x00C00000
107
#define EMAC0_MR1_MF_10MB  0x00000000
108
#define EMAC0_MR1_MF_100MB 0x00400000
109
#define EMAC0_MR1_RFS  0x00300000
110
#define EMAC0_MR1_RFS_512  0x00000000
111
#define EMAC0_MR1_RFS_1024 0x00100000
112
#define EMAC0_MR1_RFS_2048 0x00200000
113
#define EMAC0_MR1_RFS_4096 0x00300000
114
#define EMAC0_MR1_TFS  0x000C0000
115
#define EMAC0_MR1_TFS_1024 0x00040000
116
#define EMAC0_MR1_TFS_2048 0x00080000
117
#define EMAC0_MR1_TR0  0x00018000
118
#define EMAC0_MR1_TR0_SINGLE 0x00000000
119
#define EMAC0_MR1_TR0_MULTI  0x00008000
120
#define EMAC0_MR1_TR0_DEP    0x00010000
121
#define EMAC0_MR1_TR1  0x00006000
122
#define EMAC0_MR1_TR1_SINGLE 0x00000000
123
#define EMAC0_MR1_TR1_MULTI  0x00002000
124
#define EMAC0_MR1_TR1_DEP    0x00004000
125
 
126
//
127
// Transmit mode register 0
128
//
129
#define EMAC0_TMR0_GNP0  0x80000000
130
#define EMAC0_TMR0_GNP1  0x40000000
131
#define EMAC0_TMR0_GNPD  0x20000000
132
#define EMAC0_TMR0_FC    0x10000000
133
 
134
//
135
// Transmit mode register 1
136
//
137
#define EMAC0_TMR1_TLR   0xF8000000
138
#define EMAC0_TMR1_TLR_SHIFT (32-5)
139
#define EMAC0_TMR1_TUR   0x00FF0000
140
#define EMAC0_TMR1_TUR_SHIFT (32-16)
141
 
142
//
143
// Receive mode register
144
//
145
#define EMAC0_RMR_SP   0x80000000
146
#define EMAC0_RMR_SFCS 0x40000000
147
#define EMAC0_RMR_RRP  0x20000000
148
#define EMAC0_RMR_RFP  0x10000000
149
#define EMAC0_RMR_ROP  0x08000000
150
#define EMAC0_RMR_RPIR 0x04000000
151
#define EMAC0_RMR_PPP  0x02000000
152
#define EMAC0_RMR_PME  0x01000000
153
#define EMAC0_RMR_PMME 0x00800000
154
#define EMAC0_RMR_IAE  0x00400000
155
#define EMAC0_RMR_MIAE 0x00200000
156
#define EMAC0_RMR_BAE  0x00100000
157
#define EMAC0_RMR_MAE  0x00080000
158
 
159
//
160
// Interrupt status
161
//
162
#define EMAC0_ISR_OVR  0x02000000  // Rx overrun
163
#define EMAC0_ISR_PP   0x01000000  // Pause packet received
164
#define EMAC0_ISR_BP   0x00800000  // Rx bad packet
165
#define EMAC0_ISR_RP   0x00400000  // Rx runt packet
166
#define EMAC0_ISR_SE   0x00200000  // Rx short event
167
#define EMAC0_ISR_ALE  0x00100000  // Rx alignment error
168
#define EMAC0_ISR_BFCS 0x00080000  // Rx bad FCS
169
#define EMAC0_ISR_PTLE 0x00040000  // Rx packet too long
170
#define EMAC0_ISR_ORE  0x00020000  // Rx packet out of range
171
#define EMAC0_ISR_IRE  0x00010000  // Rx packet in range error
172
#define EMAC0_ISR_DBDM 0x00000200
173
#define EMAC0_ISR_DB0  0x00000100
174
#define EMAC0_ISR_SE0  0x00000080
175
#define EMAC0_ISR_TE0  0x00000040
176
#define EMAC0_ISR_DB1  0x00000020
177
#define EMAC0_ISR_SE1  0x00000010
178
#define EMAC0_ISR_TE1  0x00000008
179
#define EMAC0_ISR_MOS  0x00000002
180
#define EMAC0_ISR_MOF  0x00000001
181
 
182
//
183
// Interrupt status enable - same as interrupt status
184
//
185
 
186
//
187
// STA control register - MII interface
188
//
189
#define EMAC0_STACR_PHYD 0xFFFF0000
190
#define EMAC0_STACR_PHYD_SHIFT (32-16)
191
#define EMAC0_STACR_OC   0x00008000
192
#define EMAC0_STACR_PHYE 0x00004000
193
#define EMAC0_STACR_STAC 0x00003000
194
#define EMAC0_STACR_STAC_READ  0x00001000
195
#define EMAC0_STACR_STAC_WRITE 0x00002000
196
#define EMAC0_STACR_OPBC 0x00000C00
197
#define EMAC0_STACR_OPBC_50    0x00000000
198
#define EMAC0_STACR_OPBC_66    0x00000400
199
#define EMAC0_STACR_OPBC_83    0x00000800
200
#define EMAC0_STACR_OPBC_100   0x00000C00
201
#define EMAC0_STACR_PCDA 0x000003E0
202
#define EMAC0_STACR_PCDA_SHIFT (32-27)
203
#define EMAC0_STACR_PRA  0x0000001F
204
 
205
//
206
// Transmit request threshold
207
//
208
#define EMAC0_TRTR_TRT   0xF8000000   // 0=64, 1=128, 2=192, etc
209
#define EMAC0_TRTR_TRT_SHIFT (32-5)
210
#define EMAC0_TRTR_TRT_SCALE 64     
211
 
212
//
213
// Receive high/low water marks
214
//
215
#define EMAC0_RWMR_RLWM 0xFF800000
216
#define EMAC0_RWMR_RLWM_SHIFT (32-9)
217
#define EMAC0_RWMR_RHWM 0x0000FF80
218
#define EMAC0_RWMR_RHWM_SHIFT (32-25)
219
 
220
//
221
// Memory Access Layer (MAL) - in DCR space
222
//
223
#define MAL0_CFG      0x180
224
#define MAL0_ESR      0x181
225
#define MAL0_IER      0x182
226
#define MAL0_TXCASR   0x184
227
#define MAL0_TXCARR   0x185
228
#define MAL0_TXEOBISR 0x186
229
#define MAL0_TXDEIR   0x187
230
#define MAL0_RXCASR   0x190
231
#define MAL0_RXCARR   0x191
232
#define MAL0_RXEOBISR 0x192
233
#define MAL0_RXDEIR   0x193
234
#define MAL0_TXCTP0R  0x1A0
235
#define MAL0_TXCTP1R  0x1A1
236
#define MAL0_RXCTP0R  0x1C0
237
#define MAL0_RXBS0    0x1E0
238
 
239
//
240
// MAL configuration
241
//
242
#define MAL_CFG_SR    0x80000000
243
#define MAL_CFG_PLBP  0x00C00000
244
#define MAL_CFG_PLBP_0 0x00000000
245
#define MAL_CFG_PLBP_1 0x00400000
246
#define MAL_CFG_PLBP_2 0x00800000
247
#define MAL_CFG_PLBP_3 0x00C00000
248
#define MAL_CFG_GA    0x00200000
249
#define MAL_CFG_OA    0x00100000
250
#define MAL_CFG_PLBLE 0x00080000
251
#define MAL_CFG_PLBLT 0x00078000
252
#define MAL_CFG_PLBLT_SHIFT (32-17)
253
#define MAL_CFG_PLBT_DEFAULT (0x07<<MAL_CFG_PLBLT_SHIFT)
254
#define MAL_CFG_PLBB  0x00004000
255
#define MAL_CFG_OPBBL 0x00000080
256
#define MAL_CFG_EOPIE 0x00000004
257
#define MAL_CFG_LEA   0x00000002
258
#define MAL_CFG_SD    0x00000001
259
 
260
//
261
// Channel active set/reset
262
//
263
#define MAL_CASR_C0   0x80000000
264
#define MAL_CASR_C1   0x40000000
265
 
266
//
267
// Error and interrupt status
268
//
269
#define MAL_ESR_EVB   0x80000000
270
#define MAL_ESR_CID   0x7E000000
271
#define MAL_ESR_CID_SHIFT (32-7)
272
#define MAL_ESR_DE    0x00100000
273
#define MAL_ESR_ONE   0x00080000
274
#define MAL_ESR_OTE   0x00040000
275
#define MAL_ESR_OSE   0x00020000
276
#define MAL_ESR_PEIN  0x00010000
277
#define MAL_ESR_DEI   0x00000010
278
#define MAL_ESR_ONEI  0x00000008
279
#define MAL_ESR_OTEI  0x00000004
280
#define MAL_ESR_OSEI  0x00000002
281
#define MAL_ESR_PBEI  0x00000001
282
#define MAL_ESR_INT_MASK 0x0000001F
283
 
284
 
285
//
286
// MAL Buffer Descriptor
287
//
288
typedef struct mal_bd {
289
    unsigned short status;
290
    unsigned short length;
291
    unsigned long  buffer;
292
} mal_bd_t;
293
 
294
//
295
// Status flags
296
//
297
#define MAL_BD_R   0x8000
298
#define MAL_BD_W   0x4000
299
#define MAL_BD_CM  0x2000
300
#define MAL_BD_L   0x1000
301
#define MAL_BD_F   0x0800
302
#define MAL_BD_I   0x0400
303
// EMAC TX bits (command - set before activating buffer)
304
#define MAL_BD_TX_GFCS 0x0200
305
#define MAL_BD_TX_GPAD 0x0100
306
#define MAL_BD_TX_ISA  0x0080
307
#define MAL_BD_TX_RSA  0x0040
308
#define MAL_BD_TX_IVLA 0x0020
309
#define MAL_BD_TX_RVLA 0x0010
310
// EMAC TX bits (status - valid after buffer completes)
311
#define MAL_BD_TX_BFCS 0x0200
312
#define MAL_BD_TX_BPP  0x0100
313
#define MAL_BD_TX_LOC  0x0080
314
#define MAL_BD_TX_EDEF 0x0040
315
#define MAL_BD_TX_ECOL 0x0020
316
#define MAL_BD_TX_LATE 0x0010
317
#define MAL_BD_TX_MULT 0x0008
318
#define MAL_BD_TX_SNGL 0x0004
319
#define MAL_BD_TX_URUN 0x0002
320
#define MAL_BD_TX_SQE  0x0001
321
// EMAC RX bits (only after buffer completes)
322
#define MAL_BD_RX_ORUN 0x0200
323
#define MAL_BD_RX_PP   0x0100
324
#define MAL_BD_RX_BP   0x0080
325
#define MAL_BD_RX_RP   0x0040
326
#define MAL_BD_RX_SE   0x0020
327
#define MAL_BD_RX_ALE  0x0010
328
#define MAL_BD_RX_BFCS 0x0008
329
#define MAL_BD_RX_PTL  0x0004
330
#define MAL_BD_RX_ORNG 0x0002
331
#define MAL_BD_RX_IRNG 0x0001
332
 
333
//
334
// Private information kept about interface
335
//
336
struct ppc405_eth_info {
337
    // These fields should be defined by the implementation
338
    int                 int_vector;
339
    char               *esa_key;        // RedBoot 'key' for device ESA
340
    unsigned char      *enaddr;
341
    int                 rxnum;          // Number of Rx buffers
342
    unsigned char      *rxbuf;          // Rx buffer space
343
    mal_bd_t           *rxbd_table;     // Rx buffer headers
344
    int                 txnum;          // Number of Tx buffers
345
    unsigned char      *txbuf;          // Tx buffer space
346
    mal_bd_t           *txbd_table;     // Tx buffer headers
347
    eth_phy_access_t   *phy;            // Routines to access PHY
348
    // The following fields are maintained by the driver
349
    volatile mal_bd_t  *txbd, *rxbd;     // Next Tx,Rx descriptor to use
350
    volatile mal_bd_t  *tbase, *rbase;   // First Tx,Rx descriptor
351
    volatile mal_bd_t  *tnext, *rnext;   // Next descriptor to check for interrupt
352
    int                 txsize, rxsize;  // Length of individual buffers
353
    int                 txactive;        // Count of active Tx buffers
354
    unsigned long       txkey[CYGNUM_DEVS_ETH_POWERPC_PPC405_TxNUM];
355
#ifdef CYGINT_IO_ETH_INT_SUPPORT_REQUIRED
356
    unsigned long       ints;            // Mask of interrupts in progress
357
#endif
358
    unsigned char       cfg_enaddr[6];   // Last configured ESA
359
};
360
 

powered by: WebSVN 2.1.0

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