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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [devs/] [eth/] [intel/] [i82544/] [v2_0/] [include/] [i82544_info.h] - Blame information for rev 448

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

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_DEVS_ETH_INTEL_I82544_INFO_H
2
#define CYGONCE_DEVS_ETH_INTEL_I82544_INFO_H
3
/*==========================================================================
4
//
5
//        i82544_info.h
6
//
7
//
8
//==========================================================================
9
//####ECOSGPLCOPYRIGHTBEGIN####
10
// -------------------------------------------
11
// This file is part of eCos, the Embedded Configurable Operating System.
12
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
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):     hmt
45
// Contributors:  hmt
46
// Date:          2000-05-03
47
// Description:
48
//
49
//####DESCRIPTIONEND####
50
*/
51
 
52
#include <pkgconf/devs_eth_intel_i82544.h>
53
 
54
#ifdef CYGDBG_DEVS_ETH_INTEL_I82544_KEEP_STATISTICS
55
# define KEEP_STATISTICS
56
# define nDISPLAY_STATISTICS
57
# define nDISPLAY_82544_STATISTICS
58
#else
59
# define nKEEP_STATISTICS
60
# define nDISPLAY_STATISTICS
61
# define nDISPLAY_82544_STATISTICS
62
#endif
63
 
64
 
65
// ------------------------------------------------------------------------
66
//
67
//                       STATISTICAL COUNTER STRUCTURE
68
//
69
// ------------------------------------------------------------------------
70
#ifdef KEEP_STATISTICS
71
typedef struct {
72
/*  0 */    cyg_uint32 tx_good;
73
/*  4 */    cyg_uint32 tx_max_collisions;
74
/*  8 */    cyg_uint32 tx_late_collisions;
75
/* 12 */    cyg_uint32 tx_underrun;
76
/* 16 */    cyg_uint32 tx_carrier_loss;
77
/* 20 */    cyg_uint32 tx_deferred;
78
/* 24 */    cyg_uint32 tx_single_collisions;
79
/* 28 */    cyg_uint32 tx_mult_collisions;
80
/* 32 */    cyg_uint32 tx_total_collisions;
81
/* 36 */    cyg_uint32 rx_good;
82
/* 40 */    cyg_uint32 rx_crc_errors;
83
/* 44 */    cyg_uint32 rx_align_errors;
84
/* 48 */    cyg_uint32 rx_resource_errors;
85
/* 52 */    cyg_uint32 rx_overrun_errors;
86
/* 56 */    cyg_uint32 rx_collisions; // Always 0
87
/* 60 */    cyg_uint32 rx_short_frames;
88
// In this setup; can also be flow-control counts after.
89
// If these are to be used, a config command (as in set promiscuous mode)
90
// must be issued at start, to let those stats escape.  Params are in
91
// comments around the config command setup...
92
/* 64 */    cyg_uint32 done;
93
} I82544_COUNTERS;
94
 
95
 
96
typedef struct {
97
    cyg_uint32 interrupts;
98
    cyg_uint32 rx_count;
99
    cyg_uint32 rx_deliver;
100
    cyg_uint32 rx_resource;
101
    cyg_uint32 rx_restart;
102
    cyg_uint32 tx_count;
103
    cyg_uint32 tx_complete;
104
    cyg_uint32 tx_dropped;
105
} STATISTICS;
106
 
107
 
108
extern STATISTICS statistics[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT];
109
#ifdef CYGDBG_DEVS_ETH_INTEL_I82544_KEEP_82544_STATISTICS
110
extern I82544_COUNTERS i82544_counters[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT];
111
#endif
112
 
113
#endif // KEEP_STATISTICS
114
 
115
// ------------------------------------------------------------------------
116
//
117
//                      DEVICES AND PACKET QUEUES
118
//
119
// ------------------------------------------------------------------------
120
// The system seems to work OK with as few as 8 of RX and TX descriptors.
121
// It limps very painfully with only 4.
122
// Performance is better with more than 8.
123
// But the size of non-cached (so useless for anything else)
124
// memory window is 1Mb, so we might as well use it all.
125
//
126
// 128 for these uses the whole 1Mb, near enough.
127
 
128
#ifndef MAX_RX_DESCRIPTORS
129
#define MAX_RX_DESCRIPTORS      128     // number of Rx descriptors
130
#endif
131
#ifndef MAX_TX_DESCRIPTORS
132
#define MAX_TX_DESCRIPTORS      128     // number of Tx descriptors
133
#endif
134
 
135
typedef struct i82544 {
136
    cyg_uint8                           // (split up for atomic byte access)
137
        found:1,                        // was hardware discovered?
138
        mac_addr_ok:1,                  // can we bring up?
139
        active:1,                       // has this if been brung up?
140
        hardwired_esa:1,                // set if ESA is hardwired via CDL
141
        spare1:4;
142
    cyg_uint8                           // Count nested sends to reject
143
        within_send:8;                  //     nested requests to send
144
    cyg_uint8
145
        tx_in_progress:1,               // transmit in progress flag
146
        tx_queue_full:1,                // all Tx descriptors used flag
147
        spare3:6;
148
 
149
    cyg_uint8  index;                   // 0 or 1 or whatever
150
    cyg_uint32 devid;                   // PCI device id
151
    cyg_uint32 device;                  // Device code from hardware
152
    cyg_uint32 io_address;              // memory mapped I/O address
153
    cyg_uint8  mac_address[6];          // mac (hardware) address
154
    void *ndp;                          // Network Device Pointer
155
 
156
    cyg_int32 next_rx_descriptor;       // descriptor index for callback
157
    cyg_int32 rx_pointer;               // descriptor index for ring head
158
    CYG_ADDRESS rx_ring;                // location of Rx descriptors
159
 
160
    cyg_int32 tx_pointer;               // next TXB to check for status.
161
    CYG_ADDRESS tx_ring;                // location of Tx descriptors
162
    unsigned long tx_keys[MAX_TX_DESCRIPTORS]; // keys for tx q management
163
 
164
    // Interrupt handling stuff
165
    cyg_vector_t    vector;             // interrupt vector
166
    cyg_handle_t    interrupt_handle;   // handle for int.handler
167
    cyg_interrupt   interrupt_object;
168
 
169
#ifdef KEEP_STATISTICS
170
    void *p_statistics;                 // pointer to statistical counters
171
#endif
172
 
173
    cyg_uint32 platform_timeout;        // Some platforms use a timeout
174
    int tx_descriptor_timeout;          // Is it fixated on this tx?
175
 
176
} I82544;
177
 
178
 
179
// ------------------------------------------------------------------------
180
//
181
//                   82544 GENERAL STATUS REGISTER
182
//
183
// ------------------------------------------------------------------------
184
#define GEN_STATUS_FDX          0x01    // 1 = full duplex, 0 = half
185
#define GEN_STATUS_BPS          0xC0    // 0 = 10M, 01 = 100M, 10&11 = 1000M
186
#define GEN_STATUS_BPS_SHIFT    6  
187
#define GEN_STATUS_LINK         0x02    // 1 = link up, 0 = link down
188
 
189
extern int i82544_status( struct eth_drv_sc *sc );
190
 
191
// ------------------------------------------------------------------------
192
 
193
#ifdef KEEP_STATISTICS
194
void update_statistics(struct i82544* p_i82544);
195
#endif
196
 
197
 
198
#ifdef CYGDBG_DEVS_ETH_INTEL_I82544_KEEP_82544_STATISTICS
199
#define ETH_STATS_INIT( p ) \
200
        update_statistics( (struct i82544 *)((p)->driver_private) )
201
#else
202
#define ETH_STATS_INIT( p ) // otherwise do nothing
203
#endif
204
 
205
#define CYGDAT_DEVS_ETH_DESCRIPTION "Intel Gigabit Ethernet Controller (i82544)"
206
 
207
#define ETH_DEV_DOT3STATSETHERCHIPSET 1,3,6,1,2,1,10,7,8,2,5
208
 
209
#endif /* ifndef CYGONCE_DEVS_ETH_INTEL_I82544_INFO_H */
210
 
211
/* EOF i82544_info.h */
212
 

powered by: WebSVN 2.1.0

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