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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [devs/] [eth/] [intel/] [i82544/] [current/] [include/] [i82544_info.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
#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, 2003 Free Software Foundation, 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
17
// version.
18
//
19
// eCos is distributed in the hope that it will be useful, but WITHOUT
20
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22
// for more details.
23
//
24
// You should have received a copy of the GNU General Public License
25
// along with eCos; if not, write to the Free Software Foundation, Inc.,
26
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
27
//
28
// As a special exception, if other files instantiate templates or use
29
// macros or inline functions from this file, or you compile this file
30
// and link it with other works to produce a work based on this file,
31
// this file does not by itself cause the resulting work to be covered by
32
// the GNU General Public License. However the source code for this file
33
// must still be made available in accordance with section (3) of the GNU
34
// General Public License v2.
35
//
36
// This exception does not invalidate any other reasons why a work based
37
// on this file might be covered by the GNU General Public License.
38
// -------------------------------------------
39
// ####ECOSGPLCOPYRIGHTEND####
40
//==========================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):     hmt
44
// Contributors:  hmt
45
// Date:          2000-05-03
46
// Description:
47
//
48
//####DESCRIPTIONEND####
49
*/
50
 
51
#include <pkgconf/devs_eth_intel_i82544.h>
52
 
53
#ifdef CYGDBG_DEVS_ETH_INTEL_I82544_KEEP_STATISTICS
54
# define KEEP_STATISTICS
55
# define nDISPLAY_STATISTICS
56
# define nDISPLAY_82544_STATISTICS
57
#else
58
# define nKEEP_STATISTICS
59
# define nDISPLAY_STATISTICS
60
# define nDISPLAY_82544_STATISTICS
61
#endif
62
 
63
 
64
// ------------------------------------------------------------------------
65
//
66
//                       STATISTICAL COUNTER STRUCTURE
67
//
68
// ------------------------------------------------------------------------
69
#ifdef KEEP_STATISTICS
70
typedef struct {
71
/*  0 */    cyg_uint32 tx_good;
72
/*  4 */    cyg_uint32 tx_max_collisions;
73
/*  8 */    cyg_uint32 tx_late_collisions;
74
/* 12 */    cyg_uint32 tx_underrun;
75
/* 16 */    cyg_uint32 tx_carrier_loss;
76
/* 20 */    cyg_uint32 tx_deferred;
77
/* 24 */    cyg_uint32 tx_single_collisions;
78
/* 28 */    cyg_uint32 tx_mult_collisions;
79
/* 32 */    cyg_uint32 tx_total_collisions;
80
/* 36 */    cyg_uint32 rx_good;
81
/* 40 */    cyg_uint32 rx_crc_errors;
82
/* 44 */    cyg_uint32 rx_align_errors;
83
/* 48 */    cyg_uint32 rx_resource_errors;
84
/* 52 */    cyg_uint32 rx_overrun_errors;
85
/* 56 */    cyg_uint32 rx_collisions; // Always 0
86
/* 60 */    cyg_uint32 rx_short_frames;
87
// In this setup; can also be flow-control counts after.
88
// If these are to be used, a config command (as in set promiscuous mode)
89
// must be issued at start, to let those stats escape.  Params are in
90
// comments around the config command setup...
91
/* 64 */    cyg_uint32 done;
92
} I82544_COUNTERS;
93
 
94
 
95
typedef struct {
96
    cyg_uint32 interrupts;
97
    cyg_uint32 rx_count;
98
    cyg_uint32 rx_deliver;
99
    cyg_uint32 rx_resource;
100
    cyg_uint32 rx_restart;
101
    cyg_uint32 tx_count;
102
    cyg_uint32 tx_complete;
103
    cyg_uint32 tx_dropped;
104
} STATISTICS;
105
 
106
 
107
extern STATISTICS statistics[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT];
108
#ifdef CYGDBG_DEVS_ETH_INTEL_I82544_KEEP_82544_STATISTICS
109
extern I82544_COUNTERS i82544_counters[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT];
110
#endif
111
 
112
#endif // KEEP_STATISTICS
113
 
114
// ------------------------------------------------------------------------
115
//
116
//                      DEVICES AND PACKET QUEUES
117
//
118
// ------------------------------------------------------------------------
119
// The system seems to work OK with as few as 8 of RX and TX descriptors.
120
// It limps very painfully with only 4.
121
// Performance is better with more than 8.
122
// But the size of non-cached (so useless for anything else)
123
// memory window is 1Mb, so we might as well use it all.
124
//
125
// 128 for these uses the whole 1Mb, near enough.
126
 
127
#ifndef MAX_RX_DESCRIPTORS
128
#define MAX_RX_DESCRIPTORS      128     // number of Rx descriptors
129
#endif
130
#ifndef MAX_TX_DESCRIPTORS
131
#define MAX_TX_DESCRIPTORS      128     // number of Tx descriptors
132
#endif
133
 
134
typedef struct i82544 {
135
    cyg_uint8                           // (split up for atomic byte access)
136
        found:1,                        // was hardware discovered?
137
        mac_addr_ok:1,                  // can we bring up?
138
        active:1,                       // has this if been brung up?
139
        hardwired_esa:1,                // set if ESA is hardwired via CDL
140
        link:1,                         // set if link is up
141
        spare1:3;
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.