]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/devs/eth/powerpc/moab/v2_0/include/moab_eth.inl
Initial revision
[karo-tx-redboot.git] / packages / devs / eth / powerpc / moab / v2_0 / include / moab_eth.inl
1 #ifndef CYGONCE_DEVS_MOAB_ETH_INL
2 #define CYGONCE_DEVS_MOAB_ETH_INL
3 //==========================================================================
4 //
5 //      moab_eth.inl
6 //
7 //      Hardware specifics for TAMS MOAB ethernet support
8 //
9 //==========================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14 // Copyright (C) 2003 Gary Thomas
15 //
16 // eCos is free software; you can redistribute it and/or modify it under
17 // the terms of the GNU General Public License as published by the Free
18 // Software Foundation; either version 2 or (at your option) any later version.
19 //
20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23 // for more details.
24 //
25 // You should have received a copy of the GNU General Public License along
26 // with eCos; if not, write to the Free Software Foundation, Inc.,
27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28 //
29 // As a special exception, if other files instantiate templates or use macros
30 // or inline functions from this file, or you compile this file and link it
31 // with other works to produce a work based on this file, this file does not
32 // by itself cause the resulting work to be covered by the GNU General Public
33 // License. However the source code for this file must still be made available
34 // in accordance with section (3) of the GNU General Public License.
35 //
36 // This exception does not invalidate any other reasons why a work based on
37 // this file might be covered by the GNU General Public License.
38 //
39 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40 // at http://sources.redhat.com/ecos/ecos-license/
41 // -------------------------------------------
42 //####ECOSGPLCOPYRIGHTEND####
43 //==========================================================================
44 //#####DESCRIPTIONBEGIN####
45 //
46 // Author(s):    gthomas
47 // Contributors: gthomas
48 // Date:         2003-08-19
49 // Purpose:      
50 // Description:  
51 //              
52 //####DESCRIPTIONEND####
53 //
54 //==========================================================================
55
56 #include CYGDAT_DEVS_PPC405_ETH_CDL
57
58 #ifdef CYGHWR_DEVS_ETH_POWERPC_MOAB_ETH0
59 ETH_PHY_REG_LEVEL_ACCESS_FUNS(eth0_phy, 
60                               ppc405_eth_phy_init,
61                               NULL,
62                               ppc405_eth_phy_put_reg,
63                               ppc405_eth_phy_get_reg);
64
65 // Align buffers on a cache boundary
66 #define RxBUFSIZE CYGNUM_DEVS_ETH_POWERPC_PPC405_RxNUM*CYGNUM_DEVS_ETH_POWERPC_PPC405_BUFSIZE
67 #define TxBUFSIZE CYGNUM_DEVS_ETH_POWERPC_PPC405_TxNUM*CYGNUM_DEVS_ETH_POWERPC_PPC405_BUFSIZE
68 static unsigned char ppc405_eth_rxbufs[RxBUFSIZE] __attribute__((aligned(HAL_DCACHE_LINE_SIZE)));
69 static unsigned char ppc405_eth_txbufs[TxBUFSIZE] __attribute__((aligned(HAL_DCACHE_LINE_SIZE)));
70 static mal_bd_t ppc405_eth_rxbd[CYGNUM_DEVS_ETH_POWERPC_PPC405_RxNUM] __attribute__((aligned(HAL_DCACHE_LINE_SIZE)));
71 static mal_bd_t ppc405_eth_txbd[CYGNUM_DEVS_ETH_POWERPC_PPC405_TxNUM] __attribute__((aligned(HAL_DCACHE_LINE_SIZE)));
72
73 extern char _moab_eth0_ESA[];
74 static struct ppc405_eth_info ppc405_eth0_info = {
75     0,                                     // Interrupt vector
76     "eth0_esa",
77     _moab_eth0_ESA,
78     CYGNUM_DEVS_ETH_POWERPC_PPC405_RxNUM,  // Number of Rx buffers
79     ppc405_eth_rxbufs,                     // Rx buffer space
80     ppc405_eth_rxbd,                       // Rx buffer headers
81     CYGNUM_DEVS_ETH_POWERPC_PPC405_TxNUM,  // Number of Tx buffers
82     ppc405_eth_txbufs,                     // Tx buffer space
83     ppc405_eth_txbd,                       // Tx buffer headers
84     &eth0_phy,                             // PHY access routines
85 };
86
87 ETH_DRV_SC(ppc405_eth0_sc,
88            &ppc405_eth0_info,  // Driver specific data
89            "eth0",             // Name for this interface
90            ppc405_eth_start,
91            ppc405_eth_stop,
92            ppc405_eth_control,
93            ppc405_eth_can_send,
94            ppc405_eth_send,
95            ppc405_eth_recv,
96            ppc405_eth_deliver,
97            ppc405_eth_int,
98            ppc405_eth_int_vector);
99
100 NETDEVTAB_ENTRY(ppc405_netdev, 
101                 "eth0", 
102                 ppc405_eth_init, 
103                 &ppc405_eth0_sc);
104
105 #ifdef CYGPKG_REDBOOT
106 #include <pkgconf/redboot.h>
107 #ifdef CYGSEM_REDBOOT_FLASH_CONFIG
108 #include <redboot.h>
109 #include <flash_config.h>
110 RedBoot_config_option("eth0 network hardware address [MAC]",
111                       eth0_esa,
112                       ALWAYS_ENABLED, true,
113                       CONFIG_ESA, _moab_eth0_ESA
114     );
115 #endif // CYGSEM_REDBOOT_FLASH_CONFIG
116 #endif // CYGPKG_REDBOOT
117
118 #endif // CYGHWR_DEVS_ETH_POWERPC_MOAB_ETH0
119
120 #endif  // CYGONCE_DEVS_MOAB_ETH_INL
121 // ------------------------------------------------------------------------