1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// devs_eth_sh_se77x9.inl
|
4 |
|
|
//
|
5 |
|
|
// SE77X9 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
|
43 |
|
|
// Contributors:jskov
|
44 |
|
|
// Date: 2001-06-13
|
45 |
|
|
// Purpose: SE77X9 ethernet defintions
|
46 |
|
|
//
|
47 |
|
|
// FIXME: M17 contains an EPROM. May contain the ESA, but don't
|
48 |
|
|
// know how to access it.
|
49 |
|
|
//
|
50 |
|
|
//####DESCRIPTIONEND####
|
51 |
|
|
//==========================================================================
|
52 |
|
|
|
53 |
|
|
#include // CYGNUM_HAL_INTERRUPT_ETHR
|
54 |
|
|
#include
|
55 |
|
|
|
56 |
|
|
#ifdef __WANT_CONFIG
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
#define CYGHWR_NS_DP83902A_PLF_RESET(_dp_) \
|
61 |
|
|
CYG_MACRO_START \
|
62 |
|
|
HAL_WRITE_UINT16(_dp_->reset, 0x0000); \
|
63 |
|
|
CYGACC_CALL_IF_DELAY_US(10); \
|
64 |
|
|
HAL_WRITE_UINT16(_dp_->reset, 0x0100); \
|
65 |
|
|
CYG_MACRO_END
|
66 |
|
|
|
67 |
|
|
#define DP_IN(_b_, _o_, _d_) \
|
68 |
|
|
CYG_MACRO_START \
|
69 |
|
|
cyg_uint16 _t; \
|
70 |
|
|
HAL_READ_UINT16 ((cyg_addrword_t)(_b_)+2*(_o_), _t); \
|
71 |
|
|
(_d_) = (_t >> 8) & 0xff; \
|
72 |
|
|
CYG_MACRO_END
|
73 |
|
|
|
74 |
|
|
#define DP_OUT(_b_, _o_, _d_) \
|
75 |
|
|
CYG_MACRO_START \
|
76 |
|
|
HAL_WRITE_UINT16((cyg_addrword_t)(_b_)+2*(_o_), (_d_)<<8); \
|
77 |
|
|
CYG_MACRO_END
|
78 |
|
|
|
79 |
|
|
#define DP_IN_DATA(_b_, _d_) \
|
80 |
|
|
CYG_MACRO_START \
|
81 |
|
|
cyg_uint16 _t; \
|
82 |
|
|
HAL_READ_UINT16 ((cyg_addrword_t)(_b_), _t); \
|
83 |
|
|
(_d_) = ((_t >> 8) & 0xff) | ((_t & 0xff) << 8); \
|
84 |
|
|
CYG_MACRO_END
|
85 |
|
|
|
86 |
|
|
#define DP_OUT_DATA(_b_, _d_) \
|
87 |
|
|
CYG_MACRO_START \
|
88 |
|
|
cyg_uint16 _t; \
|
89 |
|
|
_t = (_d_); \
|
90 |
|
|
(_t) = (((_t) >> 8) & 0xff) | ((_t & 0xff) << 8); \
|
91 |
|
|
HAL_WRITE_UINT16((cyg_addrword_t)(_b_), _t); \
|
92 |
|
|
CYG_MACRO_END
|
93 |
|
|
|
94 |
|
|
#define CYGHWR_NS_DP83902A_PLF_16BIT_DATA
|
95 |
|
|
#define CYGHWR_NS_DP83902A_PLF_BROKEN_TX_DMA
|
96 |
|
|
|
97 |
|
|
#endif // __WANT_CONFIG
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
#ifdef __WANT_DEVS
|
101 |
|
|
|
102 |
|
|
#ifdef CYGPKG_DEVS_ETH_SH_SE77X9_ETH0
|
103 |
|
|
|
104 |
|
|
static dp83902a_priv_data_t dp83902a_eth0_priv_data = {
|
105 |
|
|
base : (cyg_uint8*) 0xb0000000,
|
106 |
|
|
data : (cyg_uint8*) 0xb0040000,
|
107 |
|
|
reset: (cyg_uint8*) 0xb0080000,
|
108 |
|
|
interrupt: CYGNUM_HAL_INTERRUPT_LAN,
|
109 |
|
|
tx_buf1: 0x80,
|
110 |
|
|
tx_buf2: 0x88,
|
111 |
|
|
rx_buf_start: 0x90,
|
112 |
|
|
rx_buf_end: 0xff,
|
113 |
|
|
#ifdef CYGSEM_DEVS_ETH_SH_SE77X9_ETH0_SET_ESA
|
114 |
|
|
esa : CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_ESA,
|
115 |
|
|
hardwired_esa : true,
|
116 |
|
|
#else
|
117 |
|
|
hardwired_esa : false,
|
118 |
|
|
#endif
|
119 |
|
|
};
|
120 |
|
|
|
121 |
|
|
ETH_DRV_SC(dp83902a_sc,
|
122 |
|
|
&dp83902a_eth0_priv_data, // Driver specific data
|
123 |
|
|
CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_NAME,
|
124 |
|
|
dp83902a_start,
|
125 |
|
|
dp83902a_stop,
|
126 |
|
|
dp83902a_control,
|
127 |
|
|
dp83902a_can_send,
|
128 |
|
|
dp83902a_send,
|
129 |
|
|
dp83902a_recv,
|
130 |
|
|
dp83902a_deliver, // "pseudoDSR" called from fast net thread
|
131 |
|
|
dp83902a_poll, // poll function, encapsulates ISR and DSR
|
132 |
|
|
dp83902a_int_vector);
|
133 |
|
|
|
134 |
|
|
NETDEVTAB_ENTRY(dp83902a_netdev,
|
135 |
|
|
"dp83902a_" CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_NAME,
|
136 |
|
|
dp83902a_init,
|
137 |
|
|
&dp83902a_sc);
|
138 |
|
|
#endif // CYGPKG_DEVS_ETH_SH_SE77X9_ETH0
|
139 |
|
|
|
140 |
|
|
#endif // __WANT_DEVS
|
141 |
|
|
|
142 |
|
|
// EOF devs_eth_sh_se77x9.inl
|