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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      fec.h
4
//
5
//      PowerPC MPC8xxT 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):    gthomas
43
// Contributors: gthomas
44
// Date:         2001-01-21
45
// Purpose:      
46
// Description:  
47
//              
48
//
49
//####DESCRIPTIONEND####
50
//
51
//==========================================================================
52
 
53
// PowerPC FEC (MPC8xxT) Fast Ethernet
54
 
55
// Buffer descriptor
56
struct fec_bd {
57
    unsigned short  ctrl;
58
    unsigned short  length;
59
    unsigned char  *buffer;
60
};
61
 
62
// control flags differ for Rx and Tx buffers
63
#define FEC_BD_Rx_Empty  0x8000  // Buffer is empty [FEC can fill it]
64
#define FEC_BD_Rx_Wrap   0x2000  // Last buffer in ring [wrap]
65
#define FEC_BD_Rx_Last   0x0800  // Last buffer in frame
66
#define FEC_BD_Rx_Miss   0x0100  // 
67
#define FEC_BD_Rx_BC     0x0080
68
#define FEC_BD_Rx_MC     0x0040
69
#define FEC_BD_Rx_LG     0x0020
70
#define FEC_BD_Rx_NO     0x0010
71
#define FEC_BD_Rx_SH     0x0008  // Short frame
72
#define FEC_BD_Rx_CR     0x0004  // CRC error
73
#define FEC_BD_Rx_OV     0x0002  // Overrun
74
#define FEC_BD_Rx_TR     0x0001  // Frame truncated
75
 
76
#define FEC_BD_Tx_Ready  0x8000  // Frame ready
77
#define FEC_BD_Tx_Wrap   0x2000  // Last buffer in ring
78
#define FEC_BD_Tx_Intr   0x1000  // Generate interrupt
79
#define FEC_BD_Tx_Last   0x0800  // Last buffer in frame
80
#define FEC_BD_Tx_TC     0x0400  // Send CRC after data
81
#define FEC_BD_Tx_DEF    0x0200
82
#define FEC_BD_Tx_HB     0x0100
83
#define FEC_BD_Tx_LC     0x0080
84
#define FEC_BD_Tx_RL     0x0040
85
#define FEC_BD_Tx_RC     0x003C
86
#define FEC_BD_Tx_UN     0x0002  // Underrun
87
#define FEC_BD_Tx_CSL    0x0001  // Carrier sense lost
88
 
89
#define FEC_BD_Tx_STATS  0x03FF  // Status mask
90
 
91
struct fec_eth_info {
92
    volatile struct fec        *fec;
93
    volatile struct fec_bd     *txbd, *rxbd;     // Next Tx,Rx descriptor to use
94
    volatile struct fec_bd     *tbase, *rbase;   // First Tx,Rx descriptor
95
    volatile struct fec_bd     *tnext, *rnext;   // Next descriptor to check for interrupt
96
    int                         txsize, rxsize;  // Length of individual buffers
97
    int                         txactive;        // Count of active Tx buffers
98
    unsigned long               txkey[CYGNUM_DEVS_ETH_POWERPC_FEC_TxNUM];
99
};
100
 
101
// Fast Ethernet Controller [in PPC8xxT parameter RAM space]
102
 
103
struct fec {
104
    unsigned long  addr[2];    // ESA
105
    unsigned long  hash[2];    // Address hash mask
106
    volatile struct fec_bd *RxRing;
107
    volatile struct fec_bd *TxRing;
108
    unsigned long  RxBufSize;
109
    unsigned char  _fill0[0x40-0x1C];
110
    unsigned long  eControl;   // Master control register
111
    unsigned long  iEvent;     // Interrupt event
112
    unsigned long  iMask;      // Interrupt mask
113
    unsigned long  iVector;    // Interrupt vector
114
    unsigned long  RxUpdate;   // RxRing updated
115
    unsigned long  TxUpdate;   // TxRing updated
116
    unsigned char  _fill1[0x80-0x58];
117
    unsigned long  MiiData;
118
    unsigned long  MiiSpeed;
119
    unsigned char  _fill2[0xCC-0x88];
120
    unsigned long  RxBound;    // End of FIFO RAM
121
    unsigned long  RxStart;    // Start of FIFO RAM
122
    unsigned char  _fill3[0xE4-0xD4];
123
    unsigned long  TxWater;    // Transmit watermark
124
    unsigned char  _fill4[0xEC-0xE8];
125
    unsigned long  TxStart;    // Start of Tx FIFO
126
    unsigned char  _fill5[0x134-0xF0];
127
    unsigned long  FunCode;    // DMA function codes
128
    unsigned char  _fill6[0x144-0x138];
129
    unsigned long  RxControl;  // Receiver control
130
    unsigned long  RxHash;     // Receive hash
131
    unsigned char  _fill7[0x184-0x14C];
132
    unsigned long  TxControl;  // Transmitter control
133
};
134
 
135
#define FEC_OFFSET 0x0E00      // Offset in 8xx parameter RAM
136
 
137
// Master control register (eControl)
138
#define eControl_MUX    0x0004 // Select proper pin MUX functions
139
#define eControl_EN     0x0002 // Enable ethernet controller
140
#define eControl_RESET  0x0001 // Reset controller
141
 
142
// Receiver control register (RxControl)
143
#define RxControl_BC_REJ 0x0010 // Reject broadcast frames
144
#define RxControl_PROM   0x0008 // Promiscuous mode
145
#define RxControl_MII    0x0004 // MII (1) or 7 wire (0) mode 
146
#define RxControl_DRT    0x0002 // Disable receive on transmit
147
#define RxControl_LOOP   0x0001 // Internal loopback
148
 
149
// Interrupt events
150
#define iEvent_HBERR         0x80000000  // No heartbeat error
151
#define iEvent_BABR          0x40000000  // Babling receiver
152
#define iEvent_BABT          0x20000000  // Babling transmitter
153
#define iEvent_GRA           0x10000000  // Graceful shutdown
154
#define iEvent_TFINT         0x08000000  // Transmit frame interrupt
155
#define iEvent_TXB           0x04000000  // Transmit buffer
156
#define iEvent_RFINT         0x02000000  // Receive frame
157
#define iEvent_RXB           0x01000000  // Receive buffer
158
#define iEvent_MII           0x00800000  // MII complete
159
#define iEvent_EBERR         0x00400000  // Ethernet BUS error
160
#define iEvent_all           0xFFC00000  // Any interrupt
161
 
162
// MII interface
163
#define MII_Start            0x40000000
164
#define MII_Read             0x20000000
165
#define MII_Write            0x10000000
166
#define MII_Phy(phy)         (phy << 23)
167
#define MII_Reg(reg)         (reg << 18)
168
#define MII_TA               0x00020000
169
 
170
// Transceiver mode
171
#define PHY_BMCR             0x00    // Register number
172
#define PHY_BMCR_RESET       0x8000
173
#define PHY_BMCR_LOOPBACK    0x4000
174
#define PHY_BMCR_100MB       0x2000
175
#define PHY_BMCR_AUTO_NEG    0x1000
176
#define PHY_BMCR_POWER_DOWN  0x0800
177
#define PHY_BMCR_ISOLATE     0x0400
178
#define PHY_BMCR_RESTART     0x0200
179
#define PHY_BMCR_FULL_DUPLEX 0x0100
180
#define PHY_BMCR_COLL_TEST   0x0080
181
 
182
#define PHY_BMSR             0x01    // Status register
183
#define PHY_BMSR_AUTO_NEG    0x0020  
184
#define PHY_BMSR_LINK        0x0004
185
 
186
#define IEEE_8023_MAX_FRAME         1518    // Largest possible ethernet frame
187
#define IEEE_8023_MIN_FRAME           60    // Smallest possible ethernet frame
188
 

powered by: WebSVN 2.1.0

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