]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/devs/eth/sh/se77x9/v2_0/include/devs_eth_sh_se77x9.inl
Initial revision
[karo-tx-redboot.git] / packages / devs / eth / sh / se77x9 / v2_0 / include / devs_eth_sh_se77x9.inl
1 //==========================================================================
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 Red Hat, 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 version.
16 //
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20 // for more details.
21 //
22 // You should have received a copy of the GNU General Public License along
23 // with eCos; if not, write to the Free Software Foundation, Inc.,
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 //
26 // As a special exception, if other files instantiate templates or use macros
27 // or inline functions from this file, or you compile this file and link it
28 // with other works to produce a work based on this file, this file does not
29 // by itself cause the resulting work to be covered by the GNU General Public
30 // License. However the source code for this file must still be made available
31 // in accordance with section (3) of the GNU General Public License.
32 //
33 // This exception does not invalidate any other reasons why a work based on
34 // this file might be covered by the GNU General Public License.
35 //
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 // at http://sources.redhat.com/ecos/ecos-license/
38 // -------------------------------------------
39 //####ECOSGPLCOPYRIGHTEND####
40 //==========================================================================
41 //#####DESCRIPTIONBEGIN####
42 //
43 // Author(s):   jskov
44 // Contributors:jskov
45 // Date:        2001-06-13
46 // Purpose:     SE77X9 ethernet defintions
47 //
48 // FIXME:       M17 contains an EPROM. May contain the ESA, but don't
49 //              know how to access it.
50 //
51 //####DESCRIPTIONEND####
52 //==========================================================================
53
54 #include <cyg/hal/hal_intr.h>           // CYGNUM_HAL_INTERRUPT_ETHR
55 #include <cyg/hal/hal_if.h>
56
57 #ifdef __WANT_CONFIG
58
59
60
61 #define CYGHWR_NS_DP83902A_PLF_RESET(_dp_)      \
62     CYG_MACRO_START                             \
63     HAL_WRITE_UINT16(_dp_->reset, 0x0000);      \
64     CYGACC_CALL_IF_DELAY_US(10);                \
65     HAL_WRITE_UINT16(_dp_->reset, 0x0100);      \
66     CYG_MACRO_END
67
68 #define DP_IN(_b_, _o_, _d_)                                    \
69     CYG_MACRO_START                                             \
70     cyg_uint16 _t;                                              \
71     HAL_READ_UINT16 ((cyg_addrword_t)(_b_)+2*(_o_), _t);        \
72     (_d_) = (_t >> 8) & 0xff;                                   \
73     CYG_MACRO_END
74
75 #define DP_OUT(_b_, _o_, _d_)                                   \
76     CYG_MACRO_START                                             \
77     HAL_WRITE_UINT16((cyg_addrword_t)(_b_)+2*(_o_), (_d_)<<8);  \
78     CYG_MACRO_END
79
80 #define DP_IN_DATA(_b_, _d_)                                    \
81     CYG_MACRO_START                                             \
82     cyg_uint16 _t;                                              \
83     HAL_READ_UINT16 ((cyg_addrword_t)(_b_), _t);                \
84     (_d_) = ((_t >> 8) & 0xff) | ((_t & 0xff) << 8);            \
85     CYG_MACRO_END
86
87 #define DP_OUT_DATA(_b_, _d_)                                   \
88     CYG_MACRO_START                                             \
89     cyg_uint16 _t;                                              \
90     _t = (_d_);                                                 \
91     (_t) = (((_t) >> 8) & 0xff) | ((_t & 0xff) << 8);           \
92     HAL_WRITE_UINT16((cyg_addrword_t)(_b_), _t);                \
93     CYG_MACRO_END
94
95 #define CYGHWR_NS_DP83902A_PLF_16BIT_DATA
96 #define CYGHWR_NS_DP83902A_PLF_BROKEN_TX_DMA
97
98 #endif // __WANT_CONFIG
99
100
101 #ifdef __WANT_DEVS
102
103 #ifdef CYGPKG_DEVS_ETH_SH_SE77X9_ETH0
104
105 static dp83902a_priv_data_t dp83902a_eth0_priv_data = { 
106     base : (cyg_uint8*) 0xb0000000,
107     data : (cyg_uint8*) 0xb0040000,
108     reset: (cyg_uint8*) 0xb0080000,
109     interrupt: CYGNUM_HAL_INTERRUPT_LAN,
110     tx_buf1: 0x80,
111     tx_buf2: 0x88,
112     rx_buf_start: 0x90,
113     rx_buf_end: 0xff,
114 #ifdef CYGSEM_DEVS_ETH_SH_SE77X9_ETH0_SET_ESA
115     esa : CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_ESA,
116     hardwired_esa : true,
117 #else
118     hardwired_esa : false,
119 #endif
120 };
121
122 ETH_DRV_SC(dp83902a_sc,
123            &dp83902a_eth0_priv_data, // Driver specific data
124            CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_NAME,
125            dp83902a_start,
126            dp83902a_stop,
127            dp83902a_control,
128            dp83902a_can_send,
129            dp83902a_send,
130            dp83902a_recv,
131            dp83902a_deliver,     // "pseudoDSR" called from fast net thread
132            dp83902a_poll,        // poll function, encapsulates ISR and DSR
133            dp83902a_int_vector);
134
135 NETDEVTAB_ENTRY(dp83902a_netdev, 
136                 "dp83902a_" CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_NAME,
137                 dp83902a_init, 
138                 &dp83902a_sc);
139 #endif // CYGPKG_DEVS_ETH_SH_SE77X9_ETH0
140
141 #endif // __WANT_DEVS
142
143 // EOF devs_eth_sh_se77x9.inl