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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [devs/] [eth/] [powerpc/] [quicc2/] [v2_0/] [src/] [fec.h] - Blame information for rev 454

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

Line No. Rev Author Line
1 27 unneback
//==========================================================================
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 Red Hat, Inc.
12
// Copyright (C) 2002 Gary Thomas
13
//
14
// eCos is free software; you can redistribute it and/or modify it under
15
// the terms of the GNU General Public License as published by the Free
16
// Software Foundation; either version 2 or (at your option) any later version.
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19
// 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 along
24
// with eCos; if not, write to the Free Software Foundation, Inc.,
25
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26
//
27
// As a special exception, if other files instantiate templates or use macros
28
// or inline functions from this file, or you compile this file and link it
29
// with other works to produce a work based on this file, this file does not
30
// by itself cause the resulting work to be covered by the GNU General Public
31
// License. However the source code for this file must still be made available
32
// in accordance with section (3) of the GNU General Public License.
33
//
34
// This exception does not invalidate any other reasons why a work based on
35
// this file might be covered by the GNU General Public License.
36
//
37
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38
// at http://sources.redhat.com/ecos/ecos-license/
39
// -------------------------------------------
40
//####ECOSGPLCOPYRIGHTEND####
41
//==========================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):    mtek
45
// Contributors: pfine
46
// Date:         2002-02-20
47
// Purpose:      
48
// Description:  
49
//              
50
//
51
//####DESCRIPTIONEND####
52
//
53
//==========================================================================
54
 
55
// The port connected to the ethernet
56
#define QUICC2_VADS_IMM_BASE  0x04700000
57
#define FCC2  1
58
 
59
/* ------------------------ */
60
/* FCC REGISTER CONSTANTS   */
61
/* ------------------------ */
62
 
63
// GFMR masks (RESET: 0x00000000)
64
#define FEC_GFMR_EN_Rx   0x00000020   // Receive enable  
65
#define FEC_GFMR_EN_Tx   0x00000010   // Transmit enable
66
#define FEC_GFMR_INIT    0x0000000C   // mode=ethernet
67
#define FEC_GFMR_OFFSET  0x11320
68
 
69
//PSMR masks (RESET: 0x00000000)
70
#define FEC_PSMR_INIT    0x00000080   // 32-bit CRC
71
#define FEC_PSMR_OFFSET  0x11324
72
 
73
//TODR masks (RESET: 0x0000)
74
#define FEC_TOD_INIT     0x0000
75
#define FEC_TOD_SET      0x8000
76
#define FEC_TOD_OFFSET   0x11328
77
 
78
//DSR masks (RESET: 0x7E7E)
79
#define FEC_DSR_INIT     0xD555
80
#define FEC_DSR_OFFSET   0x1132C
81
 
82
//FCCE & FCCM (RESET: 0x0000) 
83
#define FEC_EV_GRA   0x00800000  // Graceful stop
84
#define FEC_EV_RXC   0x00400000  // A control frame has been received
85
#define FEC_EV_TXC   0x00200000  // Out of sequence frame sent 
86
#define FEC_EV_TXE   0x00100000  // Error in transmission channel
87
#define FEC_EV_RXF   0x00080000  // A complete frame received
88
#define FEC_EV_BSY   0x00040000  // A received frame discarded due to lack
89
                                 // of buffers
90
#define FEC_EV_TXB   0x00020000  // A buffer sent to ethernet
91
#define FEC_EV_RXB   0x00010000  // A buffer that is a non-complete frame
92
                                 // is received
93
#define FEC_FCCE_OFFSET  0x11330
94
#define FEC_FCCM_OFFSET  0x11334
95
 
96
/* ------------------------------ */
97
/* FCC PARAMETER RAM CONSTANTS    */
98
/* ------------------------------ */
99
 
100
#define FEC_PRAM_RIPTR   0x3000      // 32 byte buffer in dual port RAM
101
#define FEC_PRAM_TIPTR   0xB000      // 32 byte buffer in dual port RAM
102
#define FEC_FCR_INIT     0x00000000  // Clear the reserved bits
103
#define FEC_FCR_MOT_BO   0x10000000  // Motorola byte ordering
104
#define FEC_PRAM_C_MASK  0xDEBB20E3  // Constant MASK for CRC
105
#define FEC_PRAM_C_PRES  0xFFFFFFFF  // CRC Preset
106
#define FEC_PRAM_RETLIM  15          // Retry limit
107
#define FEC_PRAM_PER_LO  5           // Persistance
108
#define FEC_PRAM_PER_HI  0       
109
#define FEC_PRAM_MRBLR   1536    
110
#define FEC_MAX_FLR      1518        // Max frame length
111
#define FEC_MIN_FLR      64          // Min frame length
112
#define FEC_PRAM_PAD_CH  0x8888
113
#define FEC_PRAM_MAXD    1520
114
#define FEC_PRAM_OFFSET  0x8500      // Offset of t_Fcc_Pram in 82xx 
115
 
116
/* ------------------------------ */
117
/* BUFFER DESCRIPTOR CONSTANTS    */
118
/* ------------------------------ */
119
#define FEC_PRAM_RxBD_Base   (FEC_PRAM_RIPTR + 0x400)
120
#define FEC_BD_Rx_Empty      0x8000  // Buffer is empty, FEC can fill
121
#define FEC_BD_Rx_Wrap       0x2000  // Wrap: Last buffer in ring
122
#define FEC_BD_Rx_Int        0x1000  // Interrupt
123
#define FEC_BD_Rx_Last       0x0800  // Last buffer in frame
124
#define FEC_BD_Rx_Miss       0x0100  // Miss: promiscious mode
125
#define FEC_BD_Rx_BC         0x0080  // Broadcast address
126
#define FEC_BD_Rx_MC         0x0040  // Multicast address
127
#define FEC_BD_Rx_LG         0x0020  // Frame length violation
128
#define FEC_BD_Rx_NO         0x0010  // Non-octet aligned frame
129
#define FEC_BD_Rx_SH         0x0008  // Short frame
130
#define FEC_BD_Rx_CR         0x0004  // CRC error
131
#define FEC_BD_Rx_OV         0x0002  // Overrun
132
#define FEC_BD_Rx_TR         0x0001  // Frame truncated. late collision
133
 
134
#define FEC_PRAM_TxBD_Base   (FEC_PRAM_TIPTR + 0x400)
135
#define FEC_BD_Tx_Ready      0x8000  // Frame ready
136
#define FEC_BD_Tx_Pad        0x4000  // Pad short frames
137
#define FEC_BD_Tx_Wrap       0x2000  // Wrap: Last buffer in ring
138
#define FEC_BD_Tx_Int        0x1000  // Interrupt
139
#define FEC_BD_Tx_Last       0x0800  // Last buffer in frame
140
#define FEC_BD_Tx_TC         0x0400  // Send CRC after data
141
#define FEC_BD_Tx_DEF        0x0200  // Defer indication
142
#define FEC_BD_Tx_HB         0x0100  // Heartbeat
143
#define FEC_BD_Tx_LC         0x0080  // Late collision
144
#define FEC_BD_Tx_RL         0x0040  // Retransmission limit
145
#define FEC_BD_Tx_RC         0x003C  // Retry count 
146
#define FEC_BD_Tx_UN         0x0002  // Underrun
147
#define FEC_BD_Tx_CSL        0x0001  // Carrier sense lost
148
 
149
 
150
// Buffer descriptor
151
struct fec_bd {
152
    volatile unsigned short  ctrl;
153
    volatile unsigned short  length;
154
    volatile unsigned char  *buffer;
155
};
156
 
157
 
158
struct fec_eth_info {
159
  volatile struct fcc_regs *fcc_reg;        // See "mpc8260.h"
160
  struct fec_bd   *txbd, *rxbd;    // Next Tx,Rx descriptor to use
161
  struct fec_bd   *tbase, *rbase;  // First Tx,Rx descriptor
162
  struct fec_bd   *tnext, *rnext;  // Next descriptor to check for interrupt
163
  int                       txsize, rxsize; // Length of individual buffers
164
  unsigned long             txkey[CYGNUM_DEVS_ETH_POWERPC_QUICC2_TxNUM];
165
};
166
 
167
// CPM_CPCR masks 
168
#define CPCR_FLG                0x00010000
169
#define CPCR_FCC2_CH            0x16200000
170
#define CPCR_GRSTOP_TX          0x00000005
171
#define CPCR_INIT_TX_RX_PARAMS  0x00000000
172
#define CPCR_MCN_FEC            0x00000300
173
#define CPCR_READY_TO_RX_CMD   0  /* Ready to receive a command */

powered by: WebSVN 2.1.0

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