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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [devs/] [eth/] [powerpc/] [quicc/] [current/] [src/] [quicc_eth.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
//      quicc_eth.h
4
//
5
//      PowerPC QUICC (MPC8xx) 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, 2003 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, nickg
44
// Date:         2000-01-10
45
// Purpose:      
46
// Description:  
47
//              
48
//
49
//####DESCRIPTIONEND####
50
//
51
//==========================================================================
52
 
53
// PowerPC QUICC (MPC8xx) Ethernet
54
 
55
#include <cyg/hal/quicc/ppc8xx.h>                  // QUICC structure definitions
56
 
57
struct quicc_eth_info {
58
    volatile struct ethernet_pram  *pram;            // Parameter RAM pointer
59
    volatile struct scc_regs       *ctl;             // SCC control registers
60
    volatile struct cp_bufdesc     *txbd, *rxbd;     // Next Tx,Rx descriptor to use
61
    struct cp_bufdesc              *tbase, *rbase;   // First Tx,Rx descriptor
62
    struct cp_bufdesc              *tnext, *rnext;   // Next descriptor to check for interrupt
63
    int                             txsize, rxsize;  // Length of individual buffers
64
    int                             txactive;        // Count of active Tx buffers
65
    unsigned long                   txkey[CYGNUM_DEVS_ETH_POWERPC_QUICC_TxNUM];
66
 
67
    // Keep some statistics
68
    cyg_uint32 interrupts;
69
 
70
    cyg_uint32 rx_count;
71
    cyg_uint32 rx_deliver;
72
    cyg_uint32 rx_resource;
73
    cyg_uint32 rx_restart;
74
    cyg_uint32 rx_good;
75
    cyg_uint32 rx_crc_errors;
76
    cyg_uint32 rx_align_errors;
77
    cyg_uint32 rx_resource_errors;
78
    cyg_uint32 rx_overrun_errors;
79
    cyg_uint32 rx_collisions;
80
    cyg_uint32 rx_short_frames;
81
    cyg_uint32 rx_long_frames;
82
    cyg_uint32 rx_miss;
83
 
84
    cyg_uint32 tx_count;
85
    cyg_uint32 tx_complete;
86
    cyg_uint32 tx_restart;
87
    cyg_uint32 tx_good;
88
    cyg_uint32 tx_dropped;
89
    cyg_uint32 tx_underrun;
90
    cyg_uint32 tx_late_collisions;
91
    cyg_uint32 tx_carrier_loss;
92
    cyg_uint32 tx_retransmit_error;
93
    cyg_uint32 tx_heartbeat_loss;
94
    cyg_uint32 tx_deferred;
95
};
96
 
97
// SCC registers - ethernet mode
98
 
99
// General SCC mode register
100
#define QUICC_SCC_GSMH_IRP          0x00040000  // Infared polarity
101
#define QUICC_SCC_GSMH_GDE          0x00010000  // Glitch detect enable
102
#define QUICC_SCC_GSMH_TCRC         0x00008000  // Transparent CRC
103
#define QUICC_SCC_GSMH_REVD         0x00004000  // Reverse data (transparent)
104
#define QUICC_SCC_GSMH_TRX          0x00002000  // Transparent Rx
105
#define QUICC_SCC_GSMH_TTX          0x00001000  // Transparent Tx
106
 
107
#define QUICC_SCC_GSML_TCI          0x10000000  // Transmit clock invert
108
#define QUICC_SCC_GSML_TPL          0x00E00000  // Tx preamble bits
109
#define QUICC_SCC_GSML_TPL_8        0x00200000  //    8 bits
110
#define QUICC_SCC_GSML_TPL_16       0x00400000  //   16 bits
111
#define QUICC_SCC_GSML_TPL_32       0x00600000  //   32 bits
112
#define QUICC_SCC_GSML_TPL_48       0x00800000  //   48 bits (used for ethernet)
113
#define QUICC_SCC_GSML_TPL_64       0x00A00000  //   64 bits
114
#define QUICC_SCC_GSML_TPL_128      0x00C00000  //  128 bits
115
#define QUICC_SCC_GSML_TPP          0x00180000  // Tx preamble pattern
116
#define QUICC_SCC_GSML_TPP_00       0x00000000  //   all zeroes
117
#define QUICC_SCC_GSML_TPP_01       0x00080000  //   10 repeats (ethernet)
118
#define QUICC_SCC_GSML_TPP_10       0x00100000  //   01 repeats
119
#define QUICC_SCC_GSML_TPP_11       0x00180000  //   all ones (localtalk)
120
#define QUICC_SCC_GSML_ENR          0x00000020  // Enable receiver
121
#define QUICC_SCC_GSML_ENT          0x00000010  // Enable transmitter
122
#define QUICC_SCC_GSML_MODE         0x0000000F  // Operating mode
123
#define QUICC_SCC_GSML_MODE_HDLC    0x00000000
124
#define QUICC_SCC_GSML_MODE_ATALK   0x00000002
125
#define QUICC_SCC_GSML_MODE_ENET    0x0000000C
126
 
127
// Function code
128
#define QUICC_SCC_FCR_BE            0x0010  // Big Endian operation
129
 
130
// Event register
131
#define QUICC_SCCE_GRC              0x0080  // Gracefull stop complete
132
#define QUICC_SCCE_TXE              0x0010  // Transmit error
133
#define QUICC_SCCE_RXF              0x0008  // Received full frame
134
#define QUICC_SCCE_BSY              0x0004  // No free receive buffers
135
#define QUICC_SCCE_TX               0x0002  // Buffer transmit complete
136
#define QUICC_SCCE_RX               0x0001  // Buffer received
137
#define QUICC_SCCE_INTS (QUICC_SCCE_TXE | QUICC_SCCE_RXF | QUICC_SCCE_TX)
138
 
139
// Protocol specific mode register
140
#define QUICC_PMSR_HEARTBEAT        0x8000  // Enable heartbeat
141
#define QUICC_PMSR_FORCE_COLLISION  0x4000  // Force a collision
142
#define QUICC_PMSR_RCV_SHORT_FRAMES 0x2000  // Accept short frames
143
#define QUICC_PMSR_INDIV_ADDR_MODE  0x1000  // Check individual address (hash)
144
#define QUICC_PMSR_ENET_CRC         0x0800  // Enable ethernet CRC mode
145
#define QUICC_PMSR_PROMISCUOUS      0x0200  // Enable promiscuous mode
146
#define QUICC_PMSR_BROADCAST        0x0100  // Accept broadcast packets
147
#define QUICC_PMSR_SPECIAL_BACKOFF  0x0080  // Enable special backoff timer
148
#define QUICC_PMSR_LOOPBACK         0x0040  // Enable loopback mode
149
#define QUICC_PMSR_SAMPLE_INPUTS    0x0020  // Discretely look at input pins
150
#define QUICC_PMSR_LATE_COLLISION   0x0010  // Enable late collision window
151
#define QUICC_PMSR_SEARCH_AFTER_22  0x000A  // Start frame search after 22 bits
152
#define QUICC_PMSR_FULL_DUPLEX      0x0001  // Full duplex mode
153
 
154
// Receive buffer status
155
#define QUICC_BD_RX_LAST            0x0800  // Last buffer in chain
156
#define QUICC_BD_RX_FIRST           0x0400  // First buffer in chain
157
#define QUICC_BD_RX_MISS            0x0100  // Missed data
158
#define QUICC_BD_RX_LG              0x0020  // Rx frame too long
159
#define QUICC_BD_RX_NO              0x0010  // Rx frame not properly aligned
160
#define QUICC_BD_RX_SH              0x0008  // Rx frame too short
161
#define QUICC_BD_RX_CR              0x0004  // Bad CRC
162
#define QUICC_BD_RX_OV              0x0002  // Rx overrun
163
#define QUICC_BD_RX_CL              0x0001  // Collision during frame  
164
 
165
#define QUICC_BD_RX_ERRORS          ( QUICC_BD_RX_CL | QUICC_BD_RX_OV | \
166
                                      QUICC_BD_RX_CR | QUICC_BD_RX_SH | \
167
                                      QUICC_BD_RX_NO | QUICC_BD_RX_LG | \
168
                                      QUICC_BD_RX_MISS )
169
 
170
// Transmit buffer status
171
#define QUICC_BD_TX_PAD             0x4000  // Pad short packets
172
#define QUICC_BD_TX_LAST            0x0800  // Last buffer in chain
173
#define QUICC_BD_TX_TC              0x0400  // Transmit CRC after buffer
174
#define QUICC_BD_TX_DEF             0x0200  // Transmission was deferred
175
#define QUICC_BD_TX_HB              0x0100  // Heartbeat detected
176
#define QUICC_BD_TX_LC              0x0080  // Late collision
177
#define QUICC_BD_TX_RL              0x0040  // Retransmit limit exceeded
178
#define QUICC_BD_TX_RC              0x003C  // Retry count
179
#define QUICC_BD_TX_UN              0x0002  // Tx underrun
180
#define QUICC_BD_TX_CSL             0x0001  // Carrier lost
181
 
182
#define QUICC_BD_TX_ERRORS          (QUICC_BD_TX_CSL | QUICC_BD_TX_UN | \
183
                                     QUICC_BD_TX_RL | QUICC_BD_TX_LC  | \
184
                                     QUICC_BD_TX_HB | QUICC_BD_TX_DEF )
185
 
186
#include CYGDAT_DEVS_QUICC_ETH_INL  // Platform specifics
187
 
188
#define IEEE_8023_MAX_FRAME         1518    // Largest possible ethernet frame
189
#define IEEE_8023_MIN_FRAME           64    // Smallest possible ethernet frame
190
 

powered by: WebSVN 2.1.0

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