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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [devs/] [eth/] [arm/] [ebsa285/] [current/] [include/] [devs_eth_ebsa285.inl] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      devs/eth/arm/ebsa285/..../include/devs_eth_ebsa285.inl
4
//
5
//      EBSA-285 ethernet I/O definitions.
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):    jskov, hmt
43
// Contributors: jskov, gthomas
44
// Date:         2001-02-28
45
// Purpose:      EBSA285 ethernet defintions
46
//####DESCRIPTIONEND####
47
//==========================================================================
48
 
49
#include            // CYGNUM_HAL_INTERRUPT_...
50
#include 
51
#include           // hal_virt_to_phys_address()
52
 
53
// --------------------------------------------------------------
54
// Platform specifics:
55
 
56
// support SDRAM with gaps in it.
57
#define CYGHWR_DEVS_ETH_INTEL_I82559_PCIMEM_DISCONTIGUOUS
58
 
59
// Interrupts are multiplex onto one interrupt pin.
60
#define CYGNUM_DEVS_ETH_INTEL_I82559_SEPARATE_MUX_INTERRUPT \
61
          CYGNUM_HAL_INTERRUPT_PCI_IRQ
62
 
63
// This brings on code to perform a selective reset on the device if the CU
64
// wedges.
65
 
66
#define CYGHWR_DEVS_ETH_INTEL_I82559_DEAD_TO (368640) // 0.1S of OS timer
67
 
68
// The mask on an SA110 is really an enable: 1 => enabled, 0 => masked.
69
// So to behave nestedly, we only need save the old value of the bits
70
// of interest.
71
 
72
#define CYGPRI_DEVS_ETH_INTEL_I82559_MASK_INTERRUPTS(p_i82559,old)      \
73
CYG_MACRO_START                                                         \
74
    int cpu_intr;                                                       \
75
    int mybits =                                                        \
76
        (1 << (p_i82559->vector)) |                                     \
77
        (1 << CYGNUM_HAL_INTERRUPT_PCI_IRQ);                            \
78
                                                                        \
79
    HAL_DISABLE_INTERRUPTS( cpu_intr );                                 \
80
    old = *SA110_IRQCONT_IRQENABLE;                                     \
81
    *SA110_IRQCONT_IRQENABLECLEAR = mybits; /* clear mybits */          \
82
    HAL_RESTORE_INTERRUPTS( cpu_intr );                                 \
83
CYG_MACRO_END
84
 
85
// We must only unmask (enable) those which were unmasked before,
86
// according to the bits in old.
87
#define CYGPRI_DEVS_ETH_INTEL_I82559_UNMASK_INTERRUPTS(p_i82559,old)    \
88
CYG_MACRO_START                                                         \
89
    *SA110_IRQCONT_IRQENABLESET = old &                                 \
90
        ((1 << (p_i82559->vector)) |                                    \
91
         (1 << CYGNUM_HAL_INTERRUPT_PCI_IRQ));                          \
92
CYG_MACRO_END
93
 
94
#define CYGPRI_DEVS_ETH_INTEL_I82559_ACK_INTERRUPTS(p_i82559)   \
95
CYG_MACRO_START                                                 \
96
CYG_MACRO_END
97
 
98
 
99
// --------------------------------------------------------------
100
 
101
#define CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE
102
#define CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_SIZE
103
 
104
#define CYGHWR_INTEL_I82559_PCI_VIRT_TO_BUS( _x_ ) virt_to_bus((cyg_uint32)_x_)
105
static inline cyg_uint32 virt_to_bus(cyg_uint32 p_memory)
106
{    return (p_memory - CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE);    }
107
 
108
// --------------------------------------------------------------
109
// Construct the two interfaces
110
 
111
#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0
112
 
113
static I82559 i82559_eth0_priv_data = {
114
#ifdef CYGSEM_DEVS_ETH_ARM_EBSA285_ETH0_SET_ESA
115
    hardwired_esa: 1,
116
    mac_address: CYGDAT_DEVS_ETH_ARM_EBSA285_ETH0_ESA
117
#else
118
    hardwired_esa: 0,
119
#endif
120
};
121
 
122
ETH_DRV_SC(i82559_sc0,
123
           &i82559_eth0_priv_data,      // Driver specific data
124
           CYGDAT_DEVS_ETH_ARM_EBSA285_ETH0_NAME, // Name for device
125
           i82559_start,
126
           i82559_stop,
127
           i82559_ioctl,
128
           i82559_can_send,
129
           i82559_send,
130
           i82559_recv,
131
           i82559_deliver,
132
           i82559_poll,
133
           i82559_int_vector
134
    );
135
 
136
NETDEVTAB_ENTRY(i82559_netdev0,
137
                "i82559_" CYGDAT_DEVS_ETH_ARM_EBSA285_ETH0_NAME,
138
                i82559_init,
139
                &i82559_sc0);
140
 
141
#endif // CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0
142
 
143
#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1
144
 
145
static I82559 i82559_eth1_priv_data = {
146
#ifdef CYGSEM_DEVS_ETH_ARM_EBSA285_ETH1_SET_ESA
147
    hardwired_esa: 1,
148
    mac_address: CYGDAT_DEVS_ETH_ARM_EBSA285_ETH1_ESA
149
#else
150
    hardwired_esa: 0,
151
#endif
152
};
153
 
154
ETH_DRV_SC(i82559_sc1,
155
           &i82559_eth1_priv_data,      // Driver specific data
156
           CYGDAT_DEVS_ETH_ARM_EBSA285_ETH1_NAME, // Name for device
157
           i82559_start,
158
           i82559_stop,
159
           i82559_ioctl,
160
           i82559_can_send,
161
           i82559_send,
162
           i82559_recv,
163
           i82559_deliver,
164
           i82559_poll,
165
           i82559_int_vector
166
    );
167
 
168
NETDEVTAB_ENTRY(i82559_netdev1,
169
                "i82559_" CYGDAT_DEVS_ETH_ARM_EBSA285_ETH1_NAME,
170
                i82559_init,
171
                &i82559_sc1);
172
 
173
#endif // CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1
174
 
175
// --------------------------------------------------------------
176
// These arrays are used for sanity checking of pointers
177
I82559 *
178
i82559_priv_array[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT] = {
179
#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0
180
    &i82559_eth0_priv_data,
181
#endif
182
#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1
183
    &i82559_eth1_priv_data,
184
#endif
185
};
186
 
187
#ifdef CYGDBG_USE_ASSERTS
188
// These are only used when assertions are enabled
189
cyg_netdevtab_entry_t *
190
i82559_netdev_array[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT] = {
191
#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0
192
    &i82559_netdev0,
193
#endif
194
#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1
195
    &i82559_netdev1,
196
#endif
197
};
198
 
199
struct eth_drv_sc *
200
i82559_sc_array[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT] = {
201
#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0
202
    &i82559_sc0,
203
#endif
204
#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1
205
    &i82559_sc1,
206
#endif
207
};
208
#endif // CYGDBG_USE_ASSERTS
209
 
210
// --------------------------------------------------------------
211
// Debugging
212
 
213
//#define CYGDBG_DEVS_ETH_INTEL_I82559_CHATTER 1
214
 
215
// --------------------------------------------------------------
216
// RedBoot configuration options for managing ESAs for us
217
 
218
#define CYGHWR_DEVS_ETH_INTEL_I82559_HAS_ONE_EEPROM 0
219
#define CYGHWR_DEVS_ETH_INTEL_I82559_HAS_ONE_EEPROM_MAC_ADJUST (1)
220
 
221
// --------------------------------------------------------------
222
 
223
// EOF devs_eth_ebsa285.inl

powered by: WebSVN 2.1.0

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