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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [devs/] [eth/] [powerpc/] [quicc2/] [current/] [src/] [fec.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      fec.h
4
//
5
//      PowerPC MPC8260 fast ethernet (FEC)
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):    mtek
43
// Contributors: pfine
44
// Date:         2002-02-20
45
// Purpose:      
46
// Description:  
47
//              
48
//
49
//####DESCRIPTIONEND####
50
//
51
//==========================================================================
52
 
53
// The port connected to the ethernet
54
#define QUICC2_VADS_IMM_BASE  0x04700000
55
#define FCC2  1
56
 
57
/* ------------------------ */
58
/* FCC REGISTER CONSTANTS   */
59
/* ------------------------ */
60
 
61
// GFMR masks (RESET: 0x00000000)
62
#define FEC_GFMR_EN_Rx   0x00000020   // Receive enable  
63
#define FEC_GFMR_EN_Tx   0x00000010   // Transmit enable
64
#define FEC_GFMR_INIT    0x0000000C   // mode=ethernet
65
#define FEC_GFMR_OFFSET  0x11320
66
 
67
//PSMR masks (RESET: 0x00000000)
68
#define FEC_PSMR_INIT    0x00000080   // 32-bit CRC
69
#define FEC_PSMR_OFFSET  0x11324
70
 
71
//TODR masks (RESET: 0x0000)
72
#define FEC_TOD_INIT     0x0000
73
#define FEC_TOD_SET      0x8000
74
#define FEC_TOD_OFFSET   0x11328
75
 
76
//DSR masks (RESET: 0x7E7E)
77
#define FEC_DSR_INIT     0xD555
78
#define FEC_DSR_OFFSET   0x1132C
79
 
80
//FCCE & FCCM (RESET: 0x0000) 
81
#define FEC_EV_GRA   0x00800000  // Graceful stop
82
#define FEC_EV_RXC   0x00400000  // A control frame has been received
83
#define FEC_EV_TXC   0x00200000  // Out of sequence frame sent 
84
#define FEC_EV_TXE   0x00100000  // Error in transmission channel
85
#define FEC_EV_RXF   0x00080000  // A complete frame received
86
#define FEC_EV_BSY   0x00040000  // A received frame discarded due to lack
87
                                 // of buffers
88
#define FEC_EV_TXB   0x00020000  // A buffer sent to ethernet
89
#define FEC_EV_RXB   0x00010000  // A buffer that is a non-complete frame
90
                                 // is received
91
#define FEC_FCCE_OFFSET  0x11330
92
#define FEC_FCCM_OFFSET  0x11334
93
 
94
/* ------------------------------ */
95
/* FCC PARAMETER RAM CONSTANTS    */
96
/* ------------------------------ */
97
 
98
#define FEC_PRAM_RIPTR   0x3000      // 32 byte buffer in dual port RAM
99
#define FEC_PRAM_TIPTR   0xB000      // 32 byte buffer in dual port RAM
100
#define FEC_FCR_INIT     0x00000000  // Clear the reserved bits
101
#define FEC_FCR_MOT_BO   0x10000000  // Motorola byte ordering
102
#define FEC_PRAM_C_MASK  0xDEBB20E3  // Constant MASK for CRC
103
#define FEC_PRAM_C_PRES  0xFFFFFFFF  // CRC Preset
104
#define FEC_PRAM_RETLIM  15          // Retry limit
105
#define FEC_PRAM_PER_LO  5           // Persistance
106
#define FEC_PRAM_PER_HI  0       
107
#define FEC_PRAM_MRBLR   1536    
108
#define FEC_MAX_FLR      1518        // Max frame length
109
#define FEC_MIN_FLR      64          // Min frame length
110
#define FEC_PRAM_PAD_CH  0x8888
111
#define FEC_PRAM_MAXD    1520
112
#define FEC_PRAM_OFFSET  0x8500      // Offset of t_Fcc_Pram in 82xx 
113
 
114
/* ------------------------------ */
115
/* BUFFER DESCRIPTOR CONSTANTS    */
116
/* ------------------------------ */
117
#define FEC_PRAM_RxBD_Base   (FEC_PRAM_RIPTR + 0x400)
118
#define FEC_BD_Rx_Empty      0x8000  // Buffer is empty, FEC can fill
119
#define FEC_BD_Rx_Wrap       0x2000  // Wrap: Last buffer in ring
120
#define FEC_BD_Rx_Int        0x1000  // Interrupt
121
#define FEC_BD_Rx_Last       0x0800  // Last buffer in frame
122
#define FEC_BD_Rx_Miss       0x0100  // Miss: promiscious mode
123
#define FEC_BD_Rx_BC         0x0080  // Broadcast address
124
#define FEC_BD_Rx_MC         0x0040  // Multicast address
125
#define FEC_BD_Rx_LG         0x0020  // Frame length violation
126
#define FEC_BD_Rx_NO         0x0010  // Non-octet aligned frame
127
#define FEC_BD_Rx_SH         0x0008  // Short frame
128
#define FEC_BD_Rx_CR         0x0004  // CRC error
129
#define FEC_BD_Rx_OV         0x0002  // Overrun
130
#define FEC_BD_Rx_TR         0x0001  // Frame truncated. late collision
131
 
132
#define FEC_PRAM_TxBD_Base   (FEC_PRAM_TIPTR + 0x400)
133
#define FEC_BD_Tx_Ready      0x8000  // Frame ready
134
#define FEC_BD_Tx_Pad        0x4000  // Pad short frames
135
#define FEC_BD_Tx_Wrap       0x2000  // Wrap: Last buffer in ring
136
#define FEC_BD_Tx_Int        0x1000  // Interrupt
137
#define FEC_BD_Tx_Last       0x0800  // Last buffer in frame
138
#define FEC_BD_Tx_TC         0x0400  // Send CRC after data
139
#define FEC_BD_Tx_DEF        0x0200  // Defer indication
140
#define FEC_BD_Tx_HB         0x0100  // Heartbeat
141
#define FEC_BD_Tx_LC         0x0080  // Late collision
142
#define FEC_BD_Tx_RL         0x0040  // Retransmission limit
143
#define FEC_BD_Tx_RC         0x003C  // Retry count 
144
#define FEC_BD_Tx_UN         0x0002  // Underrun
145
#define FEC_BD_Tx_CSL        0x0001  // Carrier sense lost
146
 
147
 
148
// Buffer descriptor
149
struct fec_bd {
150
    volatile unsigned short  ctrl;
151
    volatile unsigned short  length;
152
    volatile unsigned char  *buffer;
153
};
154
 
155
 
156
struct fec_eth_info {
157
  volatile struct fcc_regs *fcc_reg;        // See "mpc8260.h"
158
  struct fec_bd   *txbd, *rxbd;    // Next Tx,Rx descriptor to use
159
  struct fec_bd   *tbase, *rbase;  // First Tx,Rx descriptor
160
  struct fec_bd   *tnext, *rnext;  // Next descriptor to check for interrupt
161
  int                       txsize, rxsize; // Length of individual buffers
162
  unsigned long             txkey[CYGNUM_DEVS_ETH_POWERPC_QUICC2_TxNUM];
163
};
164
 
165
// CPM_CPCR masks 
166
#define CPCR_FLG                0x00010000
167
#define CPCR_FCC2_CH            0x16200000
168
#define CPCR_GRSTOP_TX          0x00000005
169
#define CPCR_INIT_TX_RX_PARAMS  0x00000000
170
#define CPCR_MCN_FEC            0x00000300
171
#define CPCR_READY_TO_RX_CMD   0  /* Ready to receive a command */

powered by: WebSVN 2.1.0

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