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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      fcc.h
4
//
5
//      PowerPC MPC8xxx fast ethernet (FCC)
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, 2003, 2004 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: pfine, mtek
44
// Date:         2003-08-19
45
// Purpose:      
46
// Description:  
47
//              
48
//
49
//####DESCRIPTIONEND####
50
//
51
//==========================================================================
52
 
53
#include <pkgconf/devs_eth_powerpc_fcc.h>
54
// The port connected to the ethernet
55
#define FCC1  0
56
#define FCC2  1
57
#define FCC3  2
58
 
59
/* ------------------------ */
60
/* FCC REGISTER CONSTANTS   */
61
/* ------------------------ */
62
 
63
// GFMR masks (RESET: 0x00000000)
64
#define FCC_GFMR_EN_Rx   0x00000020   // Receive enable  
65
#define FCC_GFMR_EN_Tx   0x00000010   // Transmit enable
66
#define FCC_GFMR_INIT    0x0000000C   // mode=ethernet
67
 
68
//PSMR masks (RESET: 0x00000000)
69
#define FCC_PSMR_INIT    0x00000080   // 32-bit CRC
70
 
71
//TODR masks (RESET: 0x0000)
72
#define FCC_TOD_INIT     0x0000
73
#define FCC_TOD_SET      0x8000
74
 
75
//DSR masks (RESET: 0x7E7E)
76
#define FCC_DSR_INIT     0xD555
77
 
78
//FCCE & FCCM (RESET: 0x0000) 
79
#define FCC_EV_GRA   0x0080  // Graceful stop
80
#define FCC_EV_RXC   0x0040  // A control frame has been received
81
#define FCC_EV_TXC   0x0020  // Out of sequence frame sent 
82
#define FCC_EV_TXE   0x0010  // Error in transmission channel
83
#define FCC_EV_RXF   0x0008  // A complete frame received
84
#define FCC_EV_BSY   0x0004  // A received frame discarded due to lack
85
                             // of buffers
86
#define FCC_EV_TXB   0x0002  // A buffer sent to ethernet
87
#define FCC_EV_RXB   0x0001  // A buffer that is a non-complete frame
88
                             // is received
89
 
90
/* ------------------------------ */
91
/* FCC PARAMETER RAM CONSTANTS    */
92
/* ------------------------------ */
93
 
94
#define FCC_FCR_INIT     0x00000000  // Clear the reserved bits
95
#define FCC_FCR_MOT_BO   0x10000000  // Motorola byte ordering
96
#define FCC_PRAM_C_MASK  0xDEBB20E3  // Constant MASK for CRC
97
#define FCC_PRAM_C_PRES  0xFFFFFFFF  // CRC Preset
98
#define FCC_PRAM_RETLIM  15          // Retry limit
99
#define FCC_PRAM_PER_LO  5           // Persistance
100
#define FCC_PRAM_PER_HI  0       
101
#define FCC_PRAM_MRBLR   1536    
102
#define FCC_MAX_FLR      1518        // Max frame length
103
#define FCC_MIN_FLR      64          // Min frame length
104
#define FCC_PRAM_PAD_CH  0x8888
105
#define FCC_PRAM_MAXD    1520
106
#define FCC1_PRAM_OFFSET  0x8400      // Offset of t_Fcc_Pram in 82xx 
107
#define FCC2_PRAM_OFFSET  0x8500      // Offset of t_Fcc_Pram in 82xx 
108
#define FCC3_PRAM_OFFSET  0x8600      // Offset of t_Fcc_Pram in 82xx
109
 
110
/* ------------------------------ */
111
/* BUFFER DESCRIPTOR CONSTANTS    */
112
/* ------------------------------ */
113
#define FCC_BD_Rx_Empty      0x8000  // Buffer is empty, FCC can fill
114
#define FCC_BD_Rx_Wrap       0x2000  // Wrap: Last buffer in ring
115
#define FCC_BD_Rx_Int        0x1000  // Interrupt
116
#define FCC_BD_Rx_Last       0x0800  // Last buffer in frame
117
#define FCC_BD_Rx_Miss       0x0100  // Miss: promiscious mode
118
#define FCC_BD_Rx_BC         0x0080  // Broadcast address
119
#define FCC_BD_Rx_MC         0x0040  // Multicast address
120
#define FCC_BD_Rx_LG         0x0020  // Frame length violation
121
#define FCC_BD_Rx_NO         0x0010  // Non-octet aligned frame
122
#define FCC_BD_Rx_SH         0x0008  // Short frame
123
#define FCC_BD_Rx_CR         0x0004  // CRC error
124
#define FCC_BD_Rx_OV         0x0002  // Overrun
125
#define FCC_BD_Rx_TR         0x0001  // Frame truncated. late collision
126
#define FCC_BD_Rx_ERRORS     (FCC_BD_Rx_LG|FCC_BD_Rx_NO|FCC_BD_Rx_SH|FCC_BD_Rx_CR|FCC_BD_Rx_OV|FCC_BD_Rx_TR)
127
 
128
#define FCC_BD_Tx_Ready      0x8000  // Frame ready
129
#define FCC_BD_Tx_Pad        0x4000  // Pad short frames
130
#define FCC_BD_Tx_Wrap       0x2000  // Wrap: Last buffer in ring
131
#define FCC_BD_Tx_Int        0x1000  // Interrupt
132
#define FCC_BD_Tx_Last       0x0800  // Last buffer in frame
133
#define FCC_BD_Tx_TC         0x0400  // Send CRC after data
134
#define FCC_BD_Tx_DEF        0x0200  // Defer indication
135
#define FCC_BD_Tx_HB         0x0100  // Heartbeat
136
#define FCC_BD_Tx_LC         0x0080  // Late collision
137
#define FCC_BD_Tx_RL         0x0040  // Retransmission limit
138
#define FCC_BD_Tx_RC         0x003C  // Retry count 
139
#define FCC_BD_Tx_UN         0x0002  // Underrun
140
#define FCC_BD_Tx_CSL        0x0001  // Carrier sense lost
141
#define FCC_BD_Tx_ERRORS     (FCC_BD_Tx_LC|FCC_BD_Tx_RL|FCC_BD_Tx_RC|FCC_BD_Tx_UN|FCC_BD_Tx_CSL)
142
 
143
 
144
// Buffer descriptor
145
struct fcc_bd {
146
    volatile unsigned short  ctrl;
147
    volatile unsigned short  length;
148
    volatile unsigned char  *buffer;
149
};
150
 
151
//
152
// Info kept about each interface
153
//
154
struct fcc_eth_info {
155
    // These fields should be defined by the implementation
156
    int                       int_vector;
157
    char                     *esa_key;        // RedBoot 'key' for device ESA
158
    unsigned char             enaddr[6];
159
    int                       rxnum;          // Number of Rx buffers
160
    unsigned char            *rxbuf;          // Rx buffer space
161
    int                       txnum;          // Number of Tx buffers
162
    unsigned char            *txbuf;          // Tx buffer space
163
#ifdef CYGPKG_DEVS_ETH_PHY
164
    eth_phy_access_t         *phy;            // Routines to access PHY
165
#endif
166
    // The rest of the structure is set up at runtime
167
    volatile struct fcc_regs *fcc_reg;        // See "mpc8260.h"
168
    struct fcc_bd            *txbd, *rxbd;    // Next Tx,Rx descriptor to use
169
    struct fcc_bd            *tbase, *rbase;  // First Tx,Rx descriptor
170
    struct fcc_bd            *tnext, *rnext;  // Next descriptor to check for interrupt
171
    int                       txsize, rxsize; // Length of individual buffers
172
    unsigned long             txkey[CYGNUM_DEVS_ETH_POWERPC_FCC_TxNUM];
173
#ifdef CYGPKG_NET
174
    cyg_interrupt             fcc_eth_interrupt;
175
    cyg_handle_t              fcc_eth_interrupt_handle;
176
#endif
177
};
178
 
179
// CPM_CPCR masks 
180
#define CPCR_GRSTOP_TX          0x00000005
181
#define CPCR_MCN_FCC            0x00000300
182
#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.